-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.dev
More file actions
33 lines (24 loc) · 1.41 KB
/
Copy pathDockerfile.dev
File metadata and controls
33 lines (24 loc) · 1.41 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
# ── Stage 1: deps ────────────────────────────────────────────────────────────
# Install node_modules in an isolated layer so they are only reinstalled when
# package-lock.json changes, not on every source code change.
FROM node:24-slim AS deps
WORKDIR /app
# Copy only the lockfiles — changes to source never invalidate this layer
COPY package.json package-lock.json ./
# ci installs exact versions from the lockfile; --prefer-offline avoids
# redundant registry requests when the layer is cached
RUN --mount=type=cache,target=/root/.npm \
npm ci --prefer-offline
# ── Stage 2: dev ─────────────────────────────────────────────────────────────
# Runtime image — source is bind-mounted at run time, not baked in.
FROM node:24-slim AS dev
WORKDIR /app
# Copy node_modules from deps stage
COPY --from=deps /app/node_modules ./node_modules
# Copy static config files that don't change often
# (source and public are bind-mounted via docker-compose volumes)
COPY package.json package-lock.json ./
COPY next.config.ts tsconfig.json postcss.config.mjs ./
EXPOSE 3000
# Docker Compose supplies the development command so it can filter noisy watch output.
CMD ["npm", "run", "dev"]