-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (37 loc) · 1.27 KB
/
Dockerfile
File metadata and controls
54 lines (37 loc) · 1.27 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:24-slim AS deps
WORKDIR /app
# Install full dependency set once for build stages.
COPY package.json ./
RUN npm install --no-audit --no-fund --ignore-scripts \
&& npm cache clean --force
FROM node:24-slim AS ui-builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY package.json ./
COPY vite.config.js ./
COPY ui ./ui
# VERSION is passed from docker build-args for version display in UI.
ARG VERSION
RUN VERSION=${VERSION} npm run build:ui
FROM node:24-slim AS prod-deps
WORKDIR /app
COPY package.json ./
COPY --from=deps /app/node_modules ./node_modules
RUN npm prune --omit=dev \
&& npm cache clean --force
FROM node:24-slim AS runtime
WORKDIR /app
COPY package.json ./
COPY --from=prod-deps /app/node_modules ./node_modules
COPY main.js ./
COPY src ./src
COPY configs ./configs
COPY ui/public ./ui/public
COPY ui/locales ./ui/locales
COPY --from=ui-builder /app/ui/dist ./ui/dist
USER node
EXPOSE 7861
ENV NODE_ENV=production
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD node -e "const port = process.env.PORT || 7861; require('http').get('http://localhost:' + port + '/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)}).on('error', () => process.exit(1));" || exit 1
CMD ["node", "main.js"]