Skip to content

Commit b3a7aa1

Browse files
committed
first docker ci implementation
1 parent 75ae554 commit b3a7aa1

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.github/workflows/docker.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Build Docker Image
2+
3+
on:
4+
push:
5+
branches: [main, ci]
6+
7+
env:
8+
REGISTRY: ghcr.io
9+
IMAGE_NAME: ${{ github.repository }}/demos
10+
11+
jobs:
12+
publish:
13+
name: Build and publish Docker image
14+
runs-on: ubuntu-latest
15+
if: github.event_name != 'pull_request' && github.actor != 'dependabot[bot]'
16+
permissions:
17+
contents: read
18+
packages: write
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Log in to GHCR
24+
uses: docker/login-action@v3
25+
with:
26+
registry: ${{ env.REGISTRY }}
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Set up QEMU
31+
uses: docker/setup-qemu-action@v3
32+
33+
- name: Set up Buildx
34+
uses: docker/setup-buildx-action@v3
35+
36+
- name: Docker meta (tags)
37+
id: meta
38+
uses: docker/metadata-action@v5
39+
with:
40+
tags: |
41+
type=ref,event=branch
42+
type=sha
43+
type=semver,pattern={{version}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
44+
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
45+
46+
- name: Build and push
47+
uses: docker/build-push-action@v6
48+
with:
49+
context: .
50+
push: true
51+
platforms: linux/amd64,linux/arm64
52+
tags: ${{ steps.meta.outputs.tags }}
53+
labels: ${{ steps.meta.outputs.labels }}
54+
cache-from: type=gha
55+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)