-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (34 loc) · 1.04 KB
/
Dockerfile
File metadata and controls
44 lines (34 loc) · 1.04 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
# ---- Base Node ----
FROM node:24-alpine AS base
WORKDIR /app
COPY /tools ./tools
COPY package*.json ./
# ---- Dependencies ----
FROM base AS build_dependencies
RUN npm ci --legacy-peer-deps
# ---- Build ----
FROM build_dependencies AS build
COPY . .
RUN npm run build
# ---- Only required dependencies ----
FROM build AS run_dependencies
WORKDIR /app/dist/apps/chat
COPY /tools /app/dist/apps/chat/tools
COPY /patches /app/dist/apps/chat/patches
RUN npm i --legacy-peer-deps
RUN node tools/patch-nextjs.js
# ---- Production ----
FROM node:24-alpine AS production
WORKDIR /app
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
ENV NODE_OPTIONS="${NODE_OPTIONS} --max-http-header-size=32768"
ENV KEEP_ALIVE_TIMEOUT=61000
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 -G nodejs nextjs
COPY --chown=nextjs:nodejs --from=run_dependencies /app/dist/apps/chat ./
USER nextjs
# Expose the port the app will run on
EXPOSE 3000 9464
# Start the application
CMD ["sh", "-c", "npm start -- --keepAliveTimeout $KEEP_ALIVE_TIMEOUT"]