Skip to content

Commit 4a7242d

Browse files
authored
add github workflow for server builds (#122)
1 parent c6aaba7 commit 4a7242d

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

.github/workflows/build-server.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Build Server
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
tags: ['v*']
9+
10+
jobs:
11+
build-and-push:
12+
name: Build and Push
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Set up QEMU
16+
uses: docker/setup-qemu-action@v3
17+
18+
- name: Set up Docker Buildx
19+
uses: docker/setup-buildx-action@v3
20+
21+
- name: Extract metadata
22+
id: meta
23+
uses: docker/metadata-action@v5
24+
with:
25+
images: ghcr.io/${{ github.repository }}
26+
# TODO: Customize tagging behavior to our needs.
27+
tags: |
28+
type=ref,event=branch
29+
type=ref,event=pr
30+
type=semver,pattern={{version}}
31+
type=semver,pattern={{major}}.{{minor}}
32+
type=sha
33+
34+
- name: Login to ghcr.io
35+
uses: docker/login-action@v3
36+
if: ${{ github.event_name != 'pull_request' }}
37+
with:
38+
registry: ghcr.io
39+
username: ${{ github.actor }}
40+
password: ${{ secrets.GITHUB_TOKEN }}
41+
42+
# TODO: Consider adding caching (`cache-from` and `cache-to`) to speed up builds.
43+
- name: Build and push
44+
uses: docker/build-push-action@v6
45+
with:
46+
platforms: linux/amd64,linux/arm64
47+
push: ${{ github.event_name != 'pull_request' }}
48+
tags: ${{ steps.meta.outputs.tags }}
49+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ RUN apk add --update --no-cache openssl python3 make g++
77
# Install pnpm.
88
ADD package.json .
99
RUN corepack enable && corepack prepare --activate
10+
# Skip prisma code generation during install.
11+
ENV PRISMA_SKIP_POSTINSTALL_GENERATE=true
12+
ENV CI=true
1013
# Fetch all node modules purely based on the pnpm lock file.
1114
COPY pnpm-lock.yaml .
1215
RUN --mount=type=cache,id=workspace,target=/root/.local/share/pnpm/store pnpm fetch

0 commit comments

Comments
 (0)