-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (33 loc) · 1.31 KB
/
Dockerfile
File metadata and controls
42 lines (33 loc) · 1.31 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
# Multi-stage Dockerfile for @solis/web (Next.js standalone)
# Context: monorepo root (needs shared/ + packages/web/ + reports/)
FROM node:22-alpine AS base
RUN corepack enable && corepack prepare pnpm@10.6.2 --activate
# --- Install + Build ---
FROM base AS builder
WORKDIR /app
# Use hoisted node_modules so standalone output gets real files, not pnpm symlinks
RUN echo "node-linker=hoisted" > .npmrc
# Copy everything needed for install + build
COPY pnpm-workspace.yaml package.json pnpm-lock.yaml tsconfig.json ./
COPY shared/ shared/
COPY packages/web/ packages/web/
COPY reports/ reports/
# Install deps and build in one stage to preserve workspace links
RUN pnpm install && \
mkdir -p packages/web/public && \
pnpm --filter @solis/web build
# --- Production ---
FROM node:22-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
RUN addgroup --system --gid 1001 nodejs && \
adduser --system --uid 1001 nextjs
COPY --from=builder /app/packages/web/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/packages/web/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/packages/web/.next/static ./packages/web/.next/static
COPY --from=builder --chown=nextjs:nodejs /app/reports ./reports
USER nextjs
EXPOSE 3001
ENV PORT=3001
ENV HOSTNAME="0.0.0.0"
CMD ["node", "packages/web/server.js"]