Skip to content

Commit 181294e

Browse files
committed
ci: add build workflow
1 parent e1b36e6 commit 181294e

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

.github/workflows/build.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Docker build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-24.04
14+
15+
permissions:
16+
contents: read
17+
packages: write # required to push to ghcr.io
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Set up qemu
24+
uses: docker/setup-qemu-action@v3
25+
26+
- name: Set up docker
27+
uses: docker/setup-buildx-action@v3
28+
29+
- name: Login to GitHub Container Registry
30+
uses: docker/login-action@v3
31+
with:
32+
registry: ghcr.io
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Docker metadata
37+
uses: docker/metadata-action@v5
38+
id: meta
39+
with:
40+
images: |
41+
ghcr.io/${{ github.repository }}
42+
tags: |
43+
type=ref,event=branch,suffix=-${{ github.sha }}
44+
type=sha,format=long
45+
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
46+
47+
- name: Build and push
48+
uses: docker/build-push-action@v6
49+
with:
50+
context: .
51+
platforms: linux/amd64
52+
push: true
53+
tags: ${{ steps.meta.outputs.tags }}
54+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)