-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (29 loc) · 1011 Bytes
/
Dockerfile
File metadata and controls
40 lines (29 loc) · 1011 Bytes
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
# ===============================
# 🔨 Builder Stage
# ===============================
FROM node:24.14.0 AS builder
# Create app directory
WORKDIR /usr/src/app
# Copy dependency manifests
COPY package.json yarn.lock ./
# Install ALL dependencies (ignore NODE_ENV for installation)
RUN NODE_ENV=development yarn install --frozen-lockfile
# Copy the rest of the application code
COPY . .
# ===============================
# 🚀 Release Stage
# ===============================
FROM node:24.14.0 AS release
# Install runtime tools (e.g., netcat, curl)
RUN apt-get update \
&& apt-get install -y --no-install-recommends netcat-openbsd curl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /usr/src/app
# Set production environment for runtime
ENV NODE_ENV=production
# Copy node_modules from the builder stage (includes ALL dependencies)
COPY --from=builder /usr/src/app/node_modules ./node_modules
# Copy application source
COPY --from=builder /usr/src/app ./
# CMD ["yarn", "start"]