-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
65 lines (51 loc) · 1.85 KB
/
Dockerfile
File metadata and controls
65 lines (51 loc) · 1.85 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
55
56
57
58
59
60
61
62
63
64
65
# =============================
# Base Node image
# =============================
FROM node:24.14.0-alpine3.23 AS base
WORKDIR /app
ENV NODE_ENV=production
# =============================
# Package preparation (stripping version for caching)
# =============================
FROM base AS package-strip
RUN apk add --no-cache jq moreutils
ADD package.json package-lock.json ./
# remove version from manifest for better caching when building a release
RUN jq '.version="build"' package.json | sponge package.json
RUN jq '.version="build"' package-lock.json | sponge package-lock.json
# =============================
# Full dependencies installation (for types and building)
# =============================
FROM base AS installer
RUN npm i -g clean-modules@3.0.4
COPY --from=package-strip /app/package.json package.json
COPY --from=package-strip /app/package-lock.json package-lock.json
# full deps install used for types and ui building
RUN npm ci --omit=optional --no-audit --no-fund
# =============================
# Build Types
# =============================
FROM installer AS types
ADD config config
RUN npm run build-types
# =============================
# Install production dependencies
# =============================
FROM installer AS server-installer
# remove other workspaces and reinstall, otherwise we can get rig have some peer dependencies from other workspaces
RUN npm ci --prefer-offline --omit=dev --omit=optional --no-audit --no-fund && \
npx clean-modules --yes
# =============================
# Final Image
# =============================
FROM base AS main
ADD /src src
ADD /index.ts index.ts
COPY --from=types /app/config config
COPY --from=server-installer /app/node_modules node_modules
ADD package.json README.md LICENSE BUILD.json* ./
EXPOSE 8080
EXPOSE 9090
USER node
WORKDIR /app
ENTRYPOINT ["node", "--max-http-header-size", "64000", "index.ts"]