Optimize Dockerfile and Next.js configuration for CI/CD efficiency. Implemented caching for npm installs, disabled React Compiler in Docker builds, and adjusted build command to use webpack. Updated GitHub Actions workflow to enhance build process with BuildKit support.
This commit is contained in:
1 parent
44f4fa98e2
commit
f585a5e35e
4 files changed
+17
-4
No files matched your search
+7
-1
@@ -4,14 +4,20 @@
|
||||
FROM node:22-alpine AS deps
|
||||
WORKDIR /app
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
RUN --mount=type=cache,target=/root/.npm \
|
||||
npm ci
|
||||
|
||||
# ---- Builder ----
|
||||
FROM node:22-alpine AS builder
|
||||
WORKDIR /app
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
# Skip React Compiler in image builds (big CPU/RAM cost on self-hosted runners)
|
||||
ENV DISABLE_REACT_COMPILER=1
|
||||
# Cap parallelism a bit so Turbopack/webpack don't thrash low-RAM hosts
|
||||
ENV NODE_OPTIONS=--max-old-space-size=3072
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
# Explicit webpack: Next 16 default Turbopack often stalls/OOMs in constrained CI
|
||||
RUN npm run build
|
||||
|
||||
# ---- Runner ----
|
||||
|
||||
Reference in new issue
Block a user