Skip to content

Commit

Permalink
Update docker-image.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
kirandevtn authored Jan 25, 2024
1 parent a6aec09 commit c00f88f
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,10 @@ jobs:
- uses: actions/checkout@v3

- name: Build the Docker image
run: |
# Extract the first 7 characters of the commit hash
COMMIT_HASH=$(echo $GITHUB_SHA | cut -c1-7)
# Get the current timestamp in the format YYYYMMDDHHMMSS
TIMESTAMP=$(date +"%Y%m%d%H%M%S")
# Build the Docker image and tag it
docker build . --file Dockerfile --tag kirandevtn/wavy:latest --tag kirandevtn/wavy:$COMMIT_HASH-$TIMESTAMP
run: docker build . --file Dockerfile --tag kirandevtn/wavy:latest

- name: Log in to Docker Hub with Access Token
run: echo "${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}" | docker login --username "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin

- name: Push the Docker image to Docker Hub
run: |
# Push both the latest tag and the specific commit hash + timestamp tag
docker push kirandevtn/wavy:latest
docker push kirandevtn/wavy:$COMMIT_HASH-$TIMESTAMP
run: docker push kirandevtn/wavy:latest

0 comments on commit c00f88f

Please sign in to comment.