Skip to content

Commit eb6d0db

Browse files
committed
feat: add GitHub Actions workflow for publishing Kbnet Server Docker image
1 parent 2bd5a4e commit eb6d0db

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Publish Kbnet Server Docker image
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- "apps/server/**"
9+
- ".github/workflows/build-server-image.yml"
10+
11+
jobs:
12+
push_to_registry:
13+
name: Push Docker image to Docker Hub
14+
runs-on: ubuntu-latest
15+
permissions:
16+
packages: write
17+
contents: read
18+
attestations: write
19+
id-token: write
20+
steps:
21+
- name: Check out the repo
22+
uses: actions/checkout@v4
23+
24+
- name: Log in to Docker Hub
25+
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
26+
with:
27+
username: ${{ secrets.DOCKER_USERNAME }}
28+
password: ${{ secrets.DOCKER_PASSWORD }}
29+
30+
- name: Extract metadata (tags, labels) for Docker
31+
id: meta
32+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
33+
with:
34+
images: p8labs/kbnet-server
35+
36+
- name: Build and push Docker image
37+
id: push
38+
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
39+
with:
40+
context: .
41+
file: ./apps/server/Dockerfile
42+
push: true
43+
tags: ${{ steps.meta.outputs.tags }}
44+
labels: ${{ steps.meta.outputs.labels }}
45+
46+
- name: Generate artifact attestation
47+
uses: actions/attest-build-provenance@v2
48+
with:
49+
subject-name: index.docker.io/p8labs/kbnet-server
50+
subject-digest: ${{ steps.push.outputs.digest }}
51+
push-to-registry: true

0 commit comments

Comments
 (0)