- api/worker: overlay package node_modules onto root (dotenv etc.), copy @fleetforge/shared at the workspace path the pnpm symlink expects - web: standalone output nests under apps/web (monorepo outputFileTracingRoot); run server.js from WORKDIR /app/apps/web with static/public at that level - deploy.sh: mount nginx config via named volume ff-nginx-conf (host path / cfg does not exist on the host inside the deployer)
28 lines
1.0 KiB
Docker
28 lines
1.0 KiB
Docker
FROM node:20-alpine AS base
|
|
RUN corepack enable && corepack prepare pnpm@9.15.0 --activate
|
|
WORKDIR /app
|
|
|
|
FROM base AS deps
|
|
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml* ./
|
|
COPY apps/worker/package.json ./apps/worker/
|
|
COPY packages/shared/package.json ./packages/shared/
|
|
RUN pnpm install --frozen-lockfile || pnpm install
|
|
|
|
FROM base AS builder
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY --from=deps /app/apps/worker/node_modules ./apps/worker/node_modules
|
|
COPY --from=deps /app/packages/shared/node_modules ./packages/shared/node_modules
|
|
COPY . .
|
|
RUN pnpm --filter @fleetforge/shared build
|
|
RUN pnpm --filter @fleetforge/worker build
|
|
|
|
FROM node:20-alpine AS runner
|
|
WORKDIR /app
|
|
RUN addgroup --system --gid 1001 nodejs && adduser --system --uid 1001 fleetforge
|
|
COPY --from=builder /app/node_modules ./node_modules
|
|
COPY --from=builder /app/apps/worker/node_modules ./node_modules
|
|
COPY --from=builder /app/apps/worker/dist ./dist
|
|
COPY --from=builder /app/apps/worker/package.json ./
|
|
USER fleetforge
|
|
CMD ["node", "dist/index.js"]
|