-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
52 lines (40 loc) · 1.4 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
FROM node:18-alpine AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY . .
RUN yarn workspaces focus --all --production
# Rebuild the source code only when needed
FROM node:18-alpine AS builder
WORKDIR /app
COPY --from=deps /app/. .
ARG NEXT_PUBLIC_ENV
ARG NEXT_PUBLIC_BASE_URL
ARG NEXT_PUBLIC_SERVER_URL
ARG NEXT_PUBLIC_APP_CONTAINER_URL
ARG PILOTAGE_GIT_REVISION
ARG NEXT_PUBLIC_CRISP_TOKEN
ARG NEXT_PUBLIC_SENTRY_DSN
ARG NEXT_PUBLIC_SENTRY_AUTH_TOKEN
ARG NEXT_PUBLIC_SENTRY_RELEASE
# Map arguments to react-scripts env variables
ENV NEXT_PUBLIC_ENV=$NEXT_PUBLIC_ENV
ENV NEXT_PUBLIC_BASE_URL=$NEXT_PUBLIC_BASE_URL
ENV NEXT_PUBLIC_SERVER_URL=$NEXT_PUBLIC_SERVER_URL
ENV NEXT_PUBLIC_APP_CONTAINER_URL=$NEXT_PUBLIC_APP_CONTAINER_URL
ENV NEXT_PUBLIC_CRISP_TOKEN=$NEXT_PUBLIC_CRISP_TOKEN
ENV NEXT_PUBLIC_SENTRY_DSN=$NEXT_PUBLIC_SENTRY_DSN
ENV NEXT_PUBLIC_SENTRY_AUTH_TOKEN=$NEXT_PUBLIC_SENTRY_AUTH_TOKEN
ENV NEXT_PUBLIC_SENTRY_RELEASE=$NEXT_PUBLIC_SENTRY_RELEASE
# Git revision for slack logs
ENV PILOTAGE_GIT_REVISION=$PILOTAGE_GIT_REVISION
ENV NEXT_TELEMETRY_DISABLED 1
RUN yarn workspaces foreach -p run build
# Production image, copy all the files and run next
FROM node:18-alpine AS runner
RUN apk add --no-cache parallel
WORKDIR /app
ENV NODE_ENV production
COPY --from=builder /app/. .
EXPOSE 5000
EXPOSE 3000
CMD parallel --ungroup --halt-on-error 2 ::: "yarn workspace server start" "yarn workspace ui start"