-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
90 lines (78 loc) · 2.98 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#get the latest alpine image from node registry
FROM node:18-alpine AS dependencies
# RUN npm i -g yarn
#set the working directory
WORKDIR /app
#copy the package and package lock files
#from local to container work directory /app
COPY package.json /app/
#Run command npm install to install packages
RUN yarn
#copy all the folder contents from local to container & build
FROM node:18-alpine as builder
ARG NEXT_PUBLIC_SOCKET_URL
ARG NEXT_PUBLIC_BOT_ID
ARG NEXT_PUBLIC_TELEMETRY_API
ARG NEXT_PUBLIC_AI_TOOLS_API
ARG NEXT_PUBLIC_BFF_API_URL
ARG NEXT_PUBLIC_PDF_GENERATOR_URL
ARG NEXT_PUBLIC_USER_SERVICE_APP_ID
ARG JWKS_URI
ARG NEXT_PUBLIC_USER_SERVICE_URL
ARG NEXT_PUBLIC_ORG_ID
ARG NEXT_PUBLIC_CONFIG_BASE_URL
ARG NEXT_PUBLIC_BOT_NAME
ARG NEXT_PUBLIC_ENTITY_DATASET_ID
ARG NEXT_PUBLIC_DEBUG
ARG NEXT_PUBLIC_SOCKET_PATH
ARG NEXT_PUBLIC_GOOGLE_KEY
ARG FUSIONAUTH_URL
ARG FUSIONAUTH_KEY
ARG NEXT_PUBLIC_DATASET_URL
ARG NEXT_PUBLIC_CLARITY_PROJECT_ID
ARG NEXT_PUBLIC_SHOW_ONBOARDING
ARG NEXT_PUBLIC_WEATHER_API
ARG NEXT_PUBLIC_INBOUND_API
ARG NEXT_PUBLIC_USER_MANAGEMENT_URL
ARG NEXT_PUBLIC_SEGMENT_ID
ENV NEXT_PUBLIC_SOCKET_URL=$NEXT_PUBLIC_SOCKET_URL
ENV NEXT_PUBLIC_BOT_ID=$NEXT_PUBLIC_BOT_ID
ENV NEXT_PUBLIC_TELEMETRY_API=$NEXT_PUBLIC_TELEMETRY_API
ENV NEXT_PUBLIC_AI_TOOLS_API=$NEXT_PUBLIC_AI_TOOLS_API
ENV NEXT_PUBLIC_BFF_API_URL=$NEXT_PUBLIC_BFF_API_URL
ENV NEXT_PUBLIC_PDF_GENERATOR_URL=$NEXT_PUBLIC_PDF_GENERATOR_URL
ENV NEXT_PUBLIC_USER_SERVICE_APP_ID=$NEXT_PUBLIC_USER_SERVICE_APP_ID
ENV JWKS_URI=$JWKS_URI
ENV NEXT_PUBLIC_USER_SERVICE_URL=$NEXT_PUBLIC_USER_SERVICE_URL
ENV NEXT_PUBLIC_ORG_ID=$NEXT_PUBLIC_ORG_ID
ENV NEXT_PUBLIC_CONFIG_BASE_URL=$NEXT_PUBLIC_CONFIG_BASE_URL
ENV NEXT_PUBLIC_BOT_NAME=$NEXT_PUBLIC_BOT_NAME
ENV NEXT_PUBLIC_ENTITY_DATASET_ID=$NEXT_PUBLIC_ENTITY_DATASET_ID
ENV NEXT_PUBLIC_DEBUG=$NEXT_PUBLIC_DEBUG
ENV NEXT_PUBLIC_SOCKET_PATH=$NEXT_PUBLIC_SOCKET_PATH
ENV NEXT_PUBLIC_GOOGLE_KEY=$NEXT_PUBLIC_GOOGLE_KEY
ENV FUSIONAUTH_URL=$FUSIONAUTH_URL
ENV FUSIONAUTH_KEY=$FUSIONAUTH_KEY
ENV NEXT_PUBLIC_DATASET_URL=$NEXT_PUBLIC_DATASET_URL
ENV NEXT_PUBLIC_CLARITY_PROJECT_ID=$NEXT_PUBLIC_CLARITY_PROJECT_ID
ENV NEXT_PUBLIC_SHOW_ONBOARDING=$NEXT_PUBLIC_SHOW_ONBOARDING
ENV NEXT_PUBLIC_WEATHER_API=$NEXT_PUBLIC_WEATHER_API
ENV NEXT_PUBLIC_INBOUND_API=$NEXT_PUBLIC_INBOUND_API
ENV NEXT_PUBLIC_USER_MANAGEMENT_URL=$NEXT_PUBLIC_USER_MANAGEMENT_URL
ENV NEXT_PUBLIC_SEGMENT_ID=$NEXT_PUBLIC_SEGMENT_ID
WORKDIR /app
COPY . .
COPY --from=dependencies /app/node_modules ./node_modules
RUN yarn run build
#specify env variables at runtime
FROM node:18-alpine as runner
WORKDIR /app
# If you are using a custom next.config.js file, uncomment this line.
COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json
RUN grep -rlE '12\.1\.6|17\.0\.2' /app/.next/static/chunks | xargs sed -i 's/12\.1\.6/xx.xx.xx/g; s/17\.0\.2/xx.xx.xx/g'
EXPOSE 3000
CMD ["yarn", "start"]