Publish Latest Images to Docker Hub #53
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Latest Images to Docker Hub | |
on: | |
create: | |
tags: | |
- '*' | |
permissions: | |
contents: read | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone Action Repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Login to Docker Hub | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build, Tag, and Push Image | |
run: | | |
# Enable Docker BuildKit | |
export DOCKER_BUILDKIT=1 | |
# Set tag variables | |
COMMIT_HASH=$(git rev-parse --short HEAD) | |
TAG_NAME=$(git describe --tags --abbrev=0) | |
# Image details | |
IMAGE_NAME="target/strelka-ui" | |
DOCKERFILE_PATH="./Dockerfile" | |
# Build, tag, and push image | |
docker build -f "${DOCKERFILE_PATH}" -t "${IMAGE_NAME}:${TAG_NAME}" -t "${IMAGE_NAME}:latest" . | |
docker push "${IMAGE_NAME}:${TAG_NAME}" | |
docker push "${IMAGE_NAME}:latest" | |
- name: Logout from Docker Hub | |
run: docker logout |