Skip to content

Commit a1c76f3

Browse files
authored
Update docker-image.yml
1 parent cbd6fc1 commit a1c76f3

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

.github/workflows/docker-image.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,23 @@ on:
77
branches: [ "main" ]
88

99
jobs:
10-
1110
build:
12-
1311
runs-on: ubuntu-latest
12+
# Define the tag once so both steps use the exact same value
13+
env:
14+
IMAGE_TAG: ${{ github.sha }}
1415

1516
steps:
1617
- uses: actions/checkout@v4
17-
- name: Build the Docker image
18-
run: docker build . --file Dockerfile --tag duylongcontainer/ui:$(date +%s)
1918

19+
- name: Log in to Docker Hub
20+
uses: docker/login-action@v3
21+
with:
22+
username: ${{ secrets.DOCKERHUB_USERNAME }}
23+
password: ${{ secrets.DOCKERHUB_TOKEN }}
24+
25+
- name: Build the Docker image
26+
run: docker build . --file Dockerfile --tag duylongcontainer/ui:${{ env.IMAGE_TAG }}
2027

2128
- name: Push to Dockerhub
22-
run: docker push duylongcontainer/ui:$(date +%s)
29+
run: docker push duylongcontainer/ui:${{ env.IMAGE_TAG }}

0 commit comments

Comments
 (0)