Skip to content

Commit 9510314

Browse files
committed
Add GitHub action for building a docker image
1 parent 81a03f4 commit 9510314

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

.github/workflows/docker.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: "Docker image"
2+
3+
on:
4+
# Build on every push to main
5+
push:
6+
branches: [main]
7+
# Build release
8+
release:
9+
types: [published]
10+
11+
env:
12+
REGISTRY: ghcr.io
13+
IMAGE_NAME: ${{ github.repository }}
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: "Check out the repo"
20+
uses: actions/checkout@v4
21+
22+
- name: Log in to the Container registry
23+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
24+
with:
25+
registry: ${{ env.REGISTRY }}
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Docker meta
30+
id: meta
31+
uses: docker/metadata-action@v5
32+
with:
33+
images: ${{ github.repository }}
34+
35+
- name: Extract metadata (tags, labels) for Docker
36+
id: meta
37+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
38+
with:
39+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
40+
41+
- name: Build and push Docker image
42+
id: push
43+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
44+
with:
45+
context: .
46+
file: studios-template/Dockerfile
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@v2
53+
with:
54+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
55+
subject-digest: ${{ steps.push.outputs.digest }}
56+
push-to-registry: true

0 commit comments

Comments
 (0)