Skip to content

Commit 04224a1

Browse files
aster-voidclaude
andcommitted
meta: add Dockerfile for Bun deployment
- Switch from adapter-cloudflare to adapter-node - sops decrypts secrets.prod.yaml at runtime - Requires SOPS_AGE_KEY env var 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 8fb7e91 commit 04224a1

File tree

5 files changed

+86
-187
lines changed

5 files changed

+86
-187
lines changed

.dockerignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
node_modules
2+
build
3+
.svelte-kit
4+
.devenv*
5+
.direnv
6+
.env
7+
.env.*
8+
!.env.sample
9+
.sops-age-key.txt
10+
secrets.dev.yaml
11+
*.db
12+
.git

Dockerfile

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
FROM oven/bun:1 AS builder
2+
WORKDIR /app
3+
4+
COPY package.json bun.lock ./
5+
RUN bun install --frozen-lockfile
6+
7+
COPY . .
8+
RUN bun run prepare
9+
10+
# Build with dummy env vars (actual values injected at runtime)
11+
RUN DATABASE_URL=postgresql://localhost/dummy \
12+
BETTER_AUTH_URL=http://localhost \
13+
BETTER_AUTH_SECRET=dummydummydummydummydummydummydu \
14+
GITHUB_CLIENT_ID=dummy \
15+
GITHUB_CLIENT_SECRET=dummy \
16+
S3_ENDPOINT=http://localhost \
17+
S3_ACCESS_KEY=dummy \
18+
S3_SECRET_KEY=dummy \
19+
S3_BUCKET=dummy \
20+
S3_PUBLIC_URL=http://localhost \
21+
bun run build
22+
23+
FROM oven/bun:1-slim
24+
WORKDIR /app
25+
26+
# Install sops and age
27+
RUN apt-get update && apt-get install -y --no-install-recommends \
28+
curl ca-certificates \
29+
&& curl -LO https://github.com/getsops/sops/releases/download/v3.9.4/sops-v3.9.4.linux.amd64 \
30+
&& mv sops-v3.9.4.linux.amd64 /usr/local/bin/sops \
31+
&& chmod +x /usr/local/bin/sops \
32+
&& curl -LO https://github.com/FiloSottile/age/releases/download/v1.2.0/age-v1.2.0-linux-amd64.tar.gz \
33+
&& tar -xzf age-v1.2.0-linux-amd64.tar.gz \
34+
&& mv age/age /usr/local/bin/ \
35+
&& rm -rf age age-v1.2.0-linux-amd64.tar.gz \
36+
&& apt-get remove -y curl && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
37+
38+
COPY --from=builder /app/build ./build
39+
COPY --from=builder /app/package.json ./
40+
COPY secrets.prod.yaml ./secrets.yaml
41+
42+
ENV NODE_ENV=production
43+
ENV PORT=3000
44+
EXPOSE 3000
45+
46+
# SOPS_AGE_KEY must be set at runtime
47+
CMD ["sops", "exec-env", "secrets.yaml", "bun build/index.js"]

0 commit comments

Comments
 (0)