forked from quantified-uncertainty/roast-my-post
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.worker
More file actions
48 lines (34 loc) · 1.25 KB
/
Copy pathDockerfile.worker
File metadata and controls
48 lines (34 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Worker Dockerfile - Simple approach that builds everything in place
FROM node:22-alpine AS builder
WORKDIR /app
# Install dependencies for build
RUN apk add --no-cache libc6-compat python3 make g++
# Enable pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate
# Copy everything
COPY . .
# Install all dependencies
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
pnpm install --frozen-lockfile
# Build workspace packages that need dist files (in dependency order)
RUN pnpm --filter @roast/db run build && \
pnpm --filter @roast/domain run build && \
pnpm --filter @roast/ai run build && \
pnpm --filter @roast/jobs run build
# ================================ Runner ================================
FROM node:22-alpine AS runner
WORKDIR /app
# Install runtime dependencies
RUN apk add --no-cache libc6-compat
RUN corepack enable && corepack prepare pnpm@latest --activate
# Create non-root user
RUN addgroup -g 1001 -S nodejs && \
adduser -S nextjs -u 1001
# Copy the entire built application from builder
COPY --from=builder --chown=nextjs:nodejs /app .
# Switch to non-root user
USER nextjs
# Set working directory for workers
WORKDIR /app/internal-packages/jobs
# Run pg-boss worker
CMD ["pnpm", "run", "process-pgboss"]