Skip to content

Commit 1368898

Browse files
committed
add docker build pipeline
1 parent 6ac3402 commit 1368898

File tree

6 files changed

+520
-3
lines changed

6 files changed

+520
-3
lines changed

.github/workflows/docker-nightly.yaml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
name: Build and Push Nightly Multi-Arch Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}/server
12+
13+
jobs:
14+
build:
15+
runs-on: ${{ matrix.runner }}
16+
permissions:
17+
contents: read
18+
packages: write
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- platform: linux/amd64
25+
runner: ubuntu-latest
26+
arch: amd64
27+
- platform: linux/arm64
28+
runner: ubuntu-24.04-arm64
29+
arch: arm64
30+
31+
steps:
32+
- name: Give GitHub Actions access to @thirdweb-dev/vault
33+
uses: webfactory/ssh-agent@a6f90b1f127823b31d4d4a8d96047790581349bd
34+
with:
35+
ssh-private-key: ${{ secrets.VAULT_REPO_DEPLOY_KEY }}
36+
37+
- name: Checkout repository
38+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
39+
40+
- name: Set up Docker Buildx
41+
uses: docker/setup-buildx-action@8026d2bc3645ea78b0d2544766a1225eb5691f89
42+
43+
- name: Log in to Container Registry
44+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
45+
with:
46+
registry: ${{ env.REGISTRY }}
47+
username: ${{ github.actor }}
48+
password: ${{ secrets.GITHUB_TOKEN }}
49+
50+
- name: Extract metadata
51+
id: meta
52+
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96
53+
with:
54+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
55+
tags: |
56+
type=raw,value=nightly
57+
type=sha,prefix={{branch}}-{{date 'YYYYMMDD'}}-
58+
59+
- name: Configure Git for SSH
60+
run: |
61+
git config --global url."git@github.com:".insteadOf "https://github.com/"
62+
63+
- name: Build and push platform-specific image
64+
id: build
65+
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c167d0c247842c735b
66+
with:
67+
context: .
68+
file: ./server/Dockerfile
69+
platforms: ${{ matrix.platform }}
70+
push: true
71+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly-${{ matrix.arch }}
72+
labels: ${{ steps.meta.outputs.labels }}
73+
cache-from: type=gha,scope=nightly-${{ matrix.arch }}
74+
cache-to: type=gha,mode=max,scope=nightly-${{ matrix.arch }}
75+
ssh: |
76+
default=${{ env.SSH_AUTH_SOCK }}
77+
78+
- name: Export digest
79+
run: |
80+
mkdir -p /tmp/digests
81+
digest="${{ steps.build.outputs.digest }}"
82+
touch "/tmp/digests/${digest#sha256:}"
83+
84+
- name: Upload digest
85+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
86+
with:
87+
name: digests-nightly-${{ matrix.arch }}
88+
path: /tmp/digests/*
89+
if-no-files-found: error
90+
retention-days: 1
91+
92+
merge:
93+
runs-on: ubuntu-latest
94+
needs: build
95+
permissions:
96+
contents: read
97+
packages: write
98+
99+
steps:
100+
- name: Download digests
101+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
102+
with:
103+
path: /tmp/digests
104+
pattern: digests-nightly-*
105+
merge-multiple: true
106+
107+
- name: Set up Docker Buildx
108+
uses: docker/setup-buildx-action@8026d2bc3645ea78b0d2544766a1225eb5691f89
109+
110+
- name: Log in to Container Registry
111+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
112+
with:
113+
registry: ${{ env.REGISTRY }}
114+
username: ${{ github.actor }}
115+
password: ${{ secrets.GITHUB_TOKEN }}
116+
117+
- name: Extract metadata
118+
id: meta
119+
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96
120+
with:
121+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
122+
tags: |
123+
type=raw,value=nightly
124+
type=sha,prefix={{branch}}-{{date 'YYYYMMDD'}}-
125+
126+
- name: Create manifest list and push
127+
working-directory: /tmp/digests
128+
run: |
129+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
130+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly-amd64 \
131+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly-arm64
132+
133+
- name: Inspect image
134+
run: |
135+
docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly

.github/workflows/docker-release.yaml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
name: Build and Push Multi-Arch Docker Image
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}/server
12+
13+
jobs:
14+
build:
15+
runs-on: ${{ matrix.runner }}
16+
permissions:
17+
contents: read
18+
packages: write
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- platform: linux/amd64
25+
runner: ubuntu-latest
26+
arch: amd64
27+
- platform: linux/arm64
28+
runner: ubuntu-24.04-arm64
29+
arch: arm64
30+
31+
steps:
32+
- name: Give GitHub Actions access to @thirdweb-dev/vault
33+
uses: webfactory/ssh-agent@a6f90b1f127823b31d4d4a8d96047790581349bd
34+
with:
35+
ssh-private-key: ${{ secrets.VAULT_REPO_DEPLOY_KEY }}
36+
37+
- name: Checkout repository
38+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
39+
40+
- name: Set up Docker Buildx
41+
uses: docker/setup-buildx-action@8026d2bc3645ea78b0d2544766a1225eb5691f89
42+
43+
- name: Log in to Container Registry
44+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
45+
with:
46+
registry: ${{ env.REGISTRY }}
47+
username: ${{ github.actor }}
48+
password: ${{ secrets.GITHUB_TOKEN }}
49+
50+
- name: Extract metadata
51+
id: meta
52+
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96
53+
with:
54+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
55+
tags: |
56+
type=ref,event=tag
57+
type=raw,value=latest,enable={{is_default_branch}}
58+
59+
- name: Configure Git for SSH
60+
run: |
61+
git config --global url."git@github.com:".insteadOf "https://github.com/"
62+
63+
- name: Build and push platform-specific image
64+
id: build
65+
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c167d0c247842c735b
66+
with:
67+
context: .
68+
file: ./server/Dockerfile
69+
platforms: ${{ matrix.platform }}
70+
push: true
71+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}-${{ matrix.arch }}
72+
labels: ${{ steps.meta.outputs.labels }}
73+
cache-from: type=gha,scope=${{ matrix.arch }}
74+
cache-to: type=gha,mode=max,scope=${{ matrix.arch }}
75+
ssh: |
76+
default=${{ env.SSH_AUTH_SOCK }}
77+
78+
- name: Export digest
79+
run: |
80+
mkdir -p /tmp/digests
81+
digest="${{ steps.build.outputs.digest }}"
82+
touch "/tmp/digests/${digest#sha256:}"
83+
84+
- name: Upload digest
85+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
86+
with:
87+
name: digests-${{ matrix.arch }}
88+
path: /tmp/digests/*
89+
if-no-files-found: error
90+
retention-days: 1
91+
92+
merge:
93+
runs-on: ubuntu-latest
94+
needs: build
95+
permissions:
96+
contents: read
97+
packages: write
98+
99+
steps:
100+
- name: Download digests
101+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
102+
with:
103+
path: /tmp/digests
104+
pattern: digests-*
105+
merge-multiple: true
106+
107+
- name: Set up Docker Buildx
108+
uses: docker/setup-buildx-action@8026d2bc3645ea78b0d2544766a1225eb5691f89
109+
110+
- name: Log in to Container Registry
111+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
112+
with:
113+
registry: ${{ env.REGISTRY }}
114+
username: ${{ github.actor }}
115+
password: ${{ secrets.GITHUB_TOKEN }}
116+
117+
- name: Extract metadata
118+
id: meta
119+
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96
120+
with:
121+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
122+
tags: |
123+
type=ref,event=tag
124+
type=raw,value=latest,enable={{is_default_branch}}
125+
126+
- name: Create manifest list and push
127+
working-directory: /tmp/digests
128+
run: |
129+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
130+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}-amd64 \
131+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}-arm64
132+
133+
- name: Inspect image
134+
run: |
135+
docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tags }}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ The server will start on `http://localhost:3069` by default.
122122

123123
Once the server is running, you can access:
124124

125-
- **API Documentation**: `http://localhost:3069/v1/scalar`
125+
- **API Documentation**: `http://localhost:3069/v1/reference`
126126
- **OpenAPI Spec**: `http://localhost:3069/v1/api.json`
127127

128128
### Available Endpoints
@@ -278,7 +278,7 @@ MIT
278278

279279
For issues and questions:
280280

281-
1. Check the API documentation at `/v1/scalar`
281+
1. Check the API documentation at `/v1/reference`
282282
2. Review server logs for error details
283283
3. Ensure Redis is running and accessible
284284
4. Verify Thirdweb credentials are valid

0 commit comments

Comments
 (0)