Skip to content

Commit ea37164

Browse files
Merge pull request #32 from chriskacerguis/main
Added GitHub CI
2 parents 15dab51 + 7c2c2e4 commit ea37164

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

.github/workflows/build.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Build Docker Image
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags: ["v*", "*.*.*"]
7+
pull_request:
8+
branches: [main]
9+
workflow_dispatch: {}
10+
11+
concurrency:
12+
group: ci-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
env:
16+
IMAGE_NAME: mkcertweb
17+
18+
jobs:
19+
build-and-push:
20+
name: Build and Push Image
21+
runs-on: ubuntu-latest
22+
if: github.event_name != 'pull_request'
23+
permissions:
24+
contents: read
25+
packages: write
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
30+
- name: Set up QEMU
31+
uses: docker/setup-qemu-action@v3
32+
33+
- name: Set up Docker Buildx
34+
uses: docker/setup-buildx-action@v3
35+
36+
- name: Log in to GHCR
37+
uses: docker/login-action@v3
38+
with:
39+
registry: ghcr.io
40+
username: ${{ github.actor }}
41+
password: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: Docker meta
44+
id: meta
45+
uses: docker/metadata-action@v5
46+
with:
47+
images: |
48+
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
49+
tags: |
50+
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
51+
type=sha
52+
type=ref,event=tag
53+
labels: |
54+
org.opencontainers.image.source=${{ github.repository }}
55+
56+
- name: Build and push
57+
uses: docker/build-push-action@v5
58+
with:
59+
context: .
60+
file: ./Dockerfile
61+
platforms: linux/amd64,linux/arm64
62+
push: true
63+
tags: ${{ steps.meta.outputs.tags }}
64+
labels: ${{ steps.meta.outputs.labels }}
65+
cache-from: type=gha
66+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)