Skip to content

Commit 15df125

Browse files
authored
Push latetes and commit sha to docker hub
1 parent 753542d commit 15df125

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

.github/workflows/docker.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ jobs:
1818
username: ${{ secrets.DOCKERHUB_USERNAME }}
1919
password: ${{ secrets.DOCKERHUB_TOKEN }}
2020

21-
- name: Build Docker image
21+
- name: Build Docker images
2222
run: |
23-
IMAGE_NAME=${{ secrets.DOCKERHUB_USERNAME }}/myhello:${{ github.sha }}
24-
docker build -t $IMAGE_NAME .
25-
26-
- name: Push Docker image
23+
IMAGE_BASE=${{ secrets.DOCKERHUB_USERNAME }}/myhello
24+
docker build -t $IMAGE_BASE:latest -t $IMAGE_BASE:${{ github.sha }} .
25+
26+
- name: Push Docker images
2727
run: |
28-
IMAGE_NAME=${{ secrets.DOCKERHUB_USERNAME }}/myhello:${{ github.sha }}
29-
docker push $IMAGE_NAME
28+
IMAGE_BASE=${{ secrets.DOCKERHUB_USERNAME }}/myhello
29+
docker push $IMAGE_BASE:latest
30+
docker push $IMAGE_BASE:${{ github.sha }}

0 commit comments

Comments
 (0)