-
Notifications
You must be signed in to change notification settings - Fork 4
45 lines (36 loc) · 1.16 KB
/
publish_latest.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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