Skip to content

Commit c7ae749

Browse files
aster-voidclaude
andcommitted
meta: use sops for Docker build secrets
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 1b34350 commit c7ae749

File tree

1 file changed

+16
-24
lines changed

1 file changed

+16
-24
lines changed

Dockerfile

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,5 @@
1-
FROM oven/bun:1 AS builder
1+
FROM oven/bun:1.3.2-slim AS base
22
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-
263
# Install sops, age, and git (for data migration)
274
RUN apt-get update && apt-get install -y --no-install-recommends \
285
curl ca-certificates git \
@@ -35,6 +12,21 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
3512
&& rm -rf age age-v1.2.0-linux-amd64.tar.gz \
3613
&& apt-get remove -y curl && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
3714

15+
FROM base AS builder
16+
17+
COPY package.json bun.lock ./
18+
RUN bun install --frozen-lockfile
19+
20+
COPY . .
21+
RUN bun run prepare
22+
23+
# Build with sops secrets
24+
ARG SOPS_AGE_KEY
25+
RUN sops exec-env secrets.prod.yaml 'bun run build'
26+
27+
FROM base AS executor
28+
WORKDIR /app
29+
3830
# Copy built application
3931
COPY --from=builder /app/build ./build
4032
COPY --from=builder /app/package.json ./

0 commit comments

Comments
 (0)