Skip to content

Publish Latest Images to Docker Hub #43

Publish Latest Images to Docker Hub

Publish Latest Images to Docker Hub #43

Workflow file for this run

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