-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathDockerfile
48 lines (36 loc) · 1.05 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
# BUILD STEP
FROM node:20-alpine3.17 AS base
RUN apk add --update python3 make g++ && rm -rf /var/cache/apk/*
ARG NODE_ENV
## base
WORKDIR /app
COPY ./package.json ./yarn.* ./
RUN yarn install --pure-lockfile
ENV PORT=3000
EXPOSE ${PORT}
## build
FROM base as build
COPY . .
ARG NEXTAUTH_SECRET
ARG REACT_APP_API_URL
ARG NEXTAUTH_URL
ARG NEXTAUTH_API_URL
ARG NEXT_PUBLIC_SIGNOUT_REDIRECT_URL
ENV NODE_ENV=production
ENV NEXTAUTH_SECRET=$NEXTAUTH_SECRET
ENV REACT_APP_API_URL=$REACT_APP_API_URL
ENV NEXTAUTH_URL=$NEXTAUTH_URL
ENV NEXTAUTH_API_URL=$NEXTAUTH_API_URL
ENV NEXT_PUBLIC_SIGNOUT_REDIRECT_URL=$NEXT_PUBLIC_SIGNOUT_REDIRECT_URL
#RUN npx nx run-many --target=build --all
RUN npx nx build web
## deploy
FROM build as deploy
WORKDIR /var/www/html
COPY --from=build /app/dist/apps/web .
RUN sh -c 'echo "[]" > /var/www/html/.next/server/next-font-manifest.json'
ENV NEXTAUTH_SECRET=dAbxJF2DRzqwGYn+BWKdj8o9ieMri4FWsmIRn77r2F8=
ENV REACT_APP_API_URL=http://backend/api
ENV NEXTAUTH_URL=http://localhost:3000
RUN yarn install --production
CMD npx next start