Skip to content

Commit 1188fb8

Browse files
committed
Add Docker CI
1 parent 8d51213 commit 1188fb8

File tree

3 files changed

+96
-0
lines changed

3 files changed

+96
-0
lines changed

Diff for: .dockerignore

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Devenv
2+
.devenv*
3+
devenv.local.nix
4+
devenv*
5+
6+
# direnv
7+
.direnv
8+
.envrc
9+
10+
# pre-commit
11+
.pre-commit-config.yaml
12+
13+
# zeabur
14+
zbpack.json
15+
16+
# github
17+
.github/

Diff for: .github/workflows/docker.yaml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Create and Publish Docker image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- v*
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
packages: write
14+
attestations: write
15+
id-token: write
16+
17+
env:
18+
REGISTRY: ghcr.io
19+
IMAGE_NAME: ${{ github.repository }}
20+
21+
jobs:
22+
docker:
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
- name: Log in to the Container registry
30+
uses: docker/login-action@master
31+
with:
32+
registry: ${{ env.REGISTRY }}
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Extract metadata (tags, labels) for Docker
37+
id: meta
38+
uses: docker/metadata-action@master
39+
with:
40+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
41+
42+
- name: Build and push Docker image
43+
id: push
44+
uses: docker/build-push-action@master
45+
with:
46+
context: .
47+
push: true
48+
tags: ${{ steps.meta.outputs.tags }}
49+
labels: ${{ steps.meta.outputs.labels }}
50+
51+
- name: Generate artifact attestation
52+
uses: actions/attest-build-provenance@main
53+
with:
54+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
55+
subject-digest: ${{ steps.push.outputs.digest }}
56+
push-to-registry: true

Diff for: .github/workflows/test.yaml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Go test
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: DeterminateSystems/nix-installer-action@main
16+
- uses: DeterminateSystems/magic-nix-cache-action@main
17+
- name: Install devenv.sh
18+
run: nix profile install nixpkgs#devenv
19+
20+
- uses: actions/checkout@v4
21+
22+
- name: Run go test
23+
run: devenv shell go test ./...

0 commit comments

Comments
 (0)