-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (28 loc) · 811 Bytes
/
Copy pathDockerfile
File metadata and controls
47 lines (28 loc) · 811 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
41
42
43
44
45
46
47
# -----------------------
# 1. Build Stage
FROM node:24-alpine AS builder
WORKDIR /app
RUN corepack enable
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY tsconfig.json tsconfig.build.json ./
COPY src ./src
RUN NODE_OPTIONS="--max-old-space-size=768" pnpm run build
# -----------------------
# 2. Production Stage
FROM node:24-alpine AS production
WORKDIR /app
ENV NODE_ENV=production
RUN corepack enable
# Create non-root user
RUN addgroup -S app && adduser -S app -G app
COPY package.json pnpm-lock.yaml ./
# Install ONLY production deps
RUN pnpm install --prod --frozen-lockfile --ignore-scripts
# Copy built files
COPY --from=builder /app/dist ./dist
# Logs dir
RUN mkdir -p /app/logs && chown -R app:app /app
USER app
EXPOSE 8000
CMD ["pnpm", "run", "start"]