Skip to content

Commit bc5efda

Browse files
committed
feat: create Docker build and publish action
1 parent 0e68fff commit bc5efda

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

.github/workflows/docker.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Build and Publish Docker Image
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
jobs:
9+
build-publish:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Set up QEMU for Docker
14+
uses: docker/setup-qemu-action@v3
15+
16+
- name: Set up Docker Buildx
17+
uses: docker/setup-buildx-action@v3
18+
19+
- name: Log into the Docker container registry
20+
if: ${{ github.event != 'pull_request' }}
21+
uses: docker/login-action@v3
22+
with:
23+
username: ${{ secrets.DOCKER_USERNAME }}
24+
password: ${{ secrets.DOCKER_PASSWORD }}
25+
26+
- name: Extract Docker metadata
27+
id: meta
28+
uses: docker/metadata-action@v5
29+
with:
30+
images: ${{ github.repository }}
31+
tags: |
32+
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}
33+
type=raw,value=edge,enable=${{ github.ref == 'refs/heads/dev' }}
34+
35+
- name: Build and push Docker image
36+
id: build-and-push
37+
uses: docker/build-push-action@v5
38+
with:
39+
platforms: linux/amd64,linux/arm64
40+
push: ${{ github.event != 'pull_request' }}
41+
tags: ${{ steps.meta.outputs.tags }}
42+
labels: ${{ steps.meta.outputs.labels }}
43+
cache-from: type=gha
44+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)