-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (38 loc) · 1.58 KB
/
Dockerfile
File metadata and controls
54 lines (38 loc) · 1.58 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
FROM node:25-slim@sha256:7a4ef576a570dad463c2e9744e6df118c9c2a3a03a9219122a9dc834e7c8049a AS build
WORKDIR /usr/src/app
# Copy only package files first for better layer caching
COPY package*.json ./
# Install all dependencies including dev for build tools
RUN npm ci --no-audit --no-fund
# Copy only TypeScript config first (changes less frequently)
COPY tsconfig*.json ./
# Copy source files
COPY src ./src
COPY public ./public
COPY scripts ./scripts
# Build with TypeScript and minify
RUN npm run build:prod && \
rm -rf src/tests src/**/*.test.* && \
find dist -name "*.map" -delete && \
find src/routes -name "*.ts" -delete && \
find src/routes -name "*.js" -delete && \
rm -rf dist/scripts && \
rm -rf vitest.config.* && \
rm -rf src/routes/**/fixtures
FROM node:25-slim@sha256:7a4ef576a570dad463c2e9744e6df118c9c2a3a03a9219122a9dc834e7c8049a
RUN apt-get update && \
apt-get install -y --no-install-recommends curl && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
WORKDIR /usr/src/app
COPY --chown=node:node package*.json ./
RUN npm ci --only=production --no-audit --no-fund && \
npm cache clean --force
COPY --chown=node:node --from=build /usr/src/app/dist ./dist
COPY --chown=node:node --from=build /usr/src/app/public ./public
COPY --chown=node:node --from=build /usr/src/app/src/routes ./src/routes
USER node
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=30s --start-period=120s --retries=3 CMD curl -f http://localhost:80/healthz || exit 1
ENV APP_ENV production
CMD ["node", "--no-warnings", "--max-old-space-size=512", "dist/src/server.js"]