Skip to content

Commit 82e6ecd

Browse files
committed
Add workflow for docker publishing
1 parent 7b2eda7 commit 82e6ecd

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.github/workflows/docker-build.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Triggers on version tags like v1.0.0, v2.1.3, etc.
7+
8+
jobs:
9+
build-and-push:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Docker Buildx
17+
uses: docker/setup-buildx-action@v3
18+
19+
- name: Log in to Docker Hub
20+
uses: docker/login-action@v3
21+
with:
22+
username: ${{ secrets.DOCKERHUB_USERNAME }}
23+
password: ${{ secrets.DOCKERHUB_TOKEN }}
24+
25+
- name: Extract tag name
26+
id: extract_tag
27+
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
28+
29+
- name: Build and push Docker image
30+
uses: docker/build-push-action@v5
31+
with:
32+
context: .
33+
push: true
34+
tags: |
35+
${{ secrets.DOCKERHUB_USERNAME }}/dust:${{ steps.extract_tag.outputs.tag }}
36+
${{ secrets.DOCKERHUB_USERNAME }}/dust:latest
37+
platforms: linux/amd64,linux/arm64
38+
cache-from: type=gha
39+
cache-to: type=gha,mode=max
40+
41+
- name: Image digest
42+
run: echo "Image pushed with digest ${{ steps.build-and-push.outputs.digest }}"

0 commit comments

Comments
 (0)