forked from epam/ai-dial-chat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
44 lines (35 loc) · 1 KB
/
Dockerfile
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:20-alpine AS base
RUN apk update && apk upgrade --no-cache libcrypto3 libssl3
WORKDIR /app
COPY /tools ./tools
COPY package*.json ./
# ---- Dependencies ----
FROM base AS build_dependencies
RUN npm ci
# ---- 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
RUN node tools/patch-nextjs.js
# ---- Production ----
FROM node:20-alpine AS production
RUN apk update && apk upgrade --no-cache libcrypto3 libssl3
WORKDIR /app
COPY --from=run_dependencies /app/dist/apps/chat ./
COPY --from=run_dependencies /app/startup.sh ./startup.sh
ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
USER nextjs
# Expose the port the app will run on
EXPOSE 3000 9464
# Start the application
CMD ["/app/startup.sh"]