-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.web
More file actions
78 lines (59 loc) · 3.27 KB
/
Copy pathDockerfile.web
File metadata and controls
78 lines (59 loc) · 3.27 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# syntax=docker/dockerfile:1.7
# ─────────────────────────────────────────────────────────────────
# Arceus Web — local-stack image (used by docker-compose.yml only).
# Vercel does NOT use this file; apps/web/vercel.json owns Vercel.
# ─────────────────────────────────────────────────────────────────
ARG NODE_VERSION=22.12-slim
# ── deps ─────────────────────────────────────────────────────────
FROM node:${NODE_VERSION} AS deps
WORKDIR /app
RUN apt-get update \
&& apt-get install -y --no-install-recommends git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY package.json package-lock.json ./
COPY apps/web/package.json apps/web/
COPY apps/api/package.json apps/api/
COPY packages/contracts/package.json packages/contracts/
COPY packages/db/package.json packages/db/
COPY packages/hippocampus/package.json packages/hippocampus/
COPY packages/company-runtime/package.json packages/company-runtime/
COPY packages/runtime-shared/package.json packages/runtime-shared/
COPY packages/task-engine/package.json packages/task-engine/
COPY packages/arceus-mcp/package.json packages/arceus-mcp/
RUN npm ci --include=dev
# ── build ────────────────────────────────────────────────────────
FROM deps AS build
WORKDIR /app
COPY tsconfig.base.json ./
COPY packages/ ./packages/
COPY apps/web/ ./apps/web/
# NEXT_PUBLIC_* values are baked into the client bundle at build time.
# Override per-deployment via build args.
ARG NEXT_PUBLIC_API_URL=http://api:4000
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
# Triggers `output: "standalone"` in apps/web/next.config.ts. Vercel never
# sets this so its bundling pipeline runs unchanged.
ENV NEXT_BUILD_STANDALONE=1
ENV NODE_ENV=production
RUN npm run build --workspace @arceus/web
# ── runtime ──────────────────────────────────────────────────────
# Standalone output writes a self-contained server tree to
# apps/web/.next/standalone/. Copy that + .next/static + public.
# No node_modules in the runtime image.
FROM node:${NODE_VERSION} AS production
WORKDIR /app
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl ca-certificates \
&& rm -rf /var/lib/apt/lists/*
RUN groupadd -g 1001 nextjs && useradd -u 1001 -g nextjs -m -s /bin/bash nextjs
COPY --from=build --chown=nextjs:nextjs /app/apps/web/.next/standalone ./
COPY --from=build --chown=nextjs:nextjs /app/apps/web/.next/static ./apps/web/.next/static
# apps/web has no `public/` directory — skip that copy entirely.
USER nextjs
ENV NODE_ENV=production \
HOSTNAME=0.0.0.0 \
PORT=3000
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
CMD curl -fsS http://localhost:${PORT}/ > /dev/null || exit 1
CMD ["node", "apps/web/server.js"]