Skip to content

Commit 304d1cf

Browse files
committed
chore: set up docker builds
1 parent 84a5d42 commit 304d1cf

5 files changed

Lines changed: 785 additions & 25 deletions

File tree

.github/workflows/build-image.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Build Docker Image
2+
3+
on:
4+
push:
5+
6+
env:
7+
REGISTRY: ghcr.io
8+
IMAGE_NAME: ${{ github.repository }}
9+
10+
jobs:
11+
docker:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
packages: write
16+
attestations: write
17+
id-token: write
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v5
21+
22+
- name: Variables
23+
id: vars
24+
run: |
25+
echo "sha_long=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
26+
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
27+
28+
- name: Log in to the Container registry
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ${{ env.REGISTRY }}
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Set up QEMU
36+
uses: docker/setup-qemu-action@v3
37+
38+
- name: Set up Docker Buildx
39+
uses: docker/setup-buildx-action@v3
40+
41+
- name: Extract metadata (tags, labels) for Docker
42+
id: meta
43+
uses: docker/metadata-action@v5
44+
with:
45+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
46+
tags: |
47+
type=sha
48+
type=raw,value=latest,enable={{is_default_branch}}
49+
50+
- name: Build and push
51+
id: push
52+
uses: docker/build-push-action@v6
53+
with:
54+
context: ./docker
55+
file: ./docker/Dockerfile
56+
push: true
57+
tags: ${{ steps.meta.outputs.tags }}
58+
labels: ${{ steps.meta.outputs.labels }}
59+
60+
- name: Generate artifact attestation
61+
uses: actions/attest-build-provenance@v3
62+
with:
63+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
64+
subject-digest: ${{ steps.push.outputs.digest }}
65+
push-to-registry: true

Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM node:24-alpine AS base
2+
ENV CI=true
3+
ENV PNPM_HOME="/pnpm"
4+
ENV PATH="$PNPM_HOME:$PATH"
5+
RUN corepack enable
6+
7+
FROM base AS deps
8+
RUN apk add --no-cache libc6-compat
9+
WORKDIR /app
10+
COPY package.json pnpm-lock.yaml ./
11+
RUN pnpm install
12+
13+
FROM base AS builder
14+
WORKDIR /app
15+
COPY --from=deps /app/node_modules ./node_modules
16+
COPY . .
17+
RUN pnpm run build && pnpm prune --prod
18+
19+
FROM base AS runner
20+
WORKDIR /app
21+
RUN addgroup --system --gid 1001 nodejs
22+
RUN adduser --system --uid 1001 nitro
23+
COPY --from=builder /app .
24+
USER nitro
25+
EXPOSE 3000
26+
ENV PORT 3000
27+
CMD ["npm", "run", "start"]

package.json

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@
66
"scripts": {
77
"dev": "vite",
88
"build": "tsc -b && vite build",
9+
"start": "node .output/server/index.mjs",
910
"preview": "vite preview",
1011
"lint": "biome check",
1112
"lint:fix": "biome check --write",
1213
"update-browser-mapping": "pnpm i -D baseline-browser-mapping@latest"
1314
},
1415
"dependencies": {
1516
"@fontsource-variable/source-sans-3": "^5.2.9",
16-
"@scouterna/design-tokens": "*",
17-
"@scouterna/ui-react": "*",
18-
"@scouterna/ui-webc": "*",
17+
"@scouterna/design-tokens": "0.0.3",
18+
"@scouterna/ui-react": "2.2.0",
19+
"@scouterna/ui-webc": "2.2.0",
1920
"@tabler/icons": "^3.35.0",
2021
"@tailwindcss/vite": "^4.1.17",
2122
"@tanstack/react-router": "^1.139.14",
@@ -41,12 +42,5 @@
4142
"globals": "^16.5.0",
4243
"typescript": "~5.9.3",
4344
"vite": "npm:rolldown-vite@7.2.10"
44-
},
45-
"pnpm": {
46-
"overrides": {
47-
"@scouterna/ui-react": "link:../../../../.local/share/pnpm/global/5/node_modules/@scouterna/ui-react",
48-
"@scouterna/design-tokens": "link:../../../../.local/share/pnpm/global/5/node_modules/@scouterna/design-tokens",
49-
"@scouterna/ui-webc": "link:../../../../.local/share/pnpm/global/5/node_modules/@scouterna/ui-webc"
50-
}
5145
}
5246
}

0 commit comments

Comments
 (0)