-
Notifications
You must be signed in to change notification settings - Fork 0
34 lines (26 loc) · 951 Bytes
/
docker-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
name: Docker Image CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Get Git commit SHA
id: git_sha
run: echo "::set-output name=sha::$(git rev-parse --short HEAD)"
- name: Build the Docker image
run: |
docker build . --file Dockerfile --tag formartha/ai1899:${{ steps.git_sha.outputs.sha }} --compress
- name: Log into Docker Hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Push Docker image to Docker Hub
run: |
docker tag formartha/ai1899:${{ steps.git_sha.outputs.sha }} formartha/ai1899:latest
docker push formartha/ai1899:latest