-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (28 loc) · 1.15 KB
/
Copy pathDockerfile
File metadata and controls
31 lines (28 loc) · 1.15 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
# Region-B container (AWS App Runner, us-east-2). Builds the Next.js standalone
# server. Region A stays on Vercel; this serves the same app reading the
# us-east-2 DSQL endpoint of the active-active cluster.
# syntax=docker/dockerfile:1
FROM node:20-slim AS base
ENV PNPM_HOME=/pnpm PATH=/pnpm:$PATH NEXT_TELEMETRY_DISABLED=1
RUN corepack enable
FROM base AS deps
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
FROM base AS build
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN pnpm build
FROM base AS run
WORKDIR /app
ENV NODE_ENV=production PORT=3000
# Next standalone output: server.js + traced node_modules; static copied alongside.
COPY --from=build /app/.next/standalone ./
COPY --from=build /app/.next/static ./.next/static
EXPOSE 3000
# The Next standalone server binds to $HOSTNAME. The container runtime sets
# HOSTNAME to the instance hostname (overriding any Dockerfile ENV), so Next
# binds to that single interface and App Runner's health check can't reach it.
# Force 0.0.0.0 at exec time — an inline assignment beats the inherited value.
CMD ["sh", "-c", "HOSTNAME=0.0.0.0 node server.js"]