Skip to content

Commit

Permalink
ci(docker): also tag and push images by commit hash
Browse files Browse the repository at this point in the history
  • Loading branch information
hoang-himself committed Aug 27, 2023
1 parent 79da560 commit c7717c5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ jobs:
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
[ "$VERSION" == "master" ] && VERSION=latest
COMMIT=$(echo "${{ github.sha }}" | cut -c 1-7)
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
echo COMMIT=$COMMIT
docker image build --tag dvwa .
docker image tag dvwa $IMAGE_ID:$VERSION
docker image tag dvwa $IMAGE_ID:$COMMIT
docker image push $IMAGE_ID:$VERSION
docker image push $IMAGE_ID:$COMMIT

0 comments on commit c7717c5

Please sign in to comment.