forked from bloom-housing/bloom
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.sites-public
65 lines (46 loc) · 2.16 KB
/
Dockerfile.sites-public
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
FROM node:14.17-alpine AS development
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /usr/src/app/
# Copy all the source code from the root of the repo into the container
COPY . ./
WORKDIR /usr/src/app/sites/public
COPY sites/public/package.json ./
COPY sites/public/yarn*.lock ./
COPY sites/public/tsconfig*.json ./
COPY sites/public/*config.js ./
RUN yarn install --frozen-lockfile
COPY sites/public .
# If not defined, use our production backend site for build-time rendering.
# In order to override it for local development when building the image on
# its own, use --build-arg BACKEND_API_BASE=<override>.
ARG BACKEND_API_BASE=https://backend-core-tj3gg4i5eq-uc.a.run.app
ARG LANGUAGES=en,es,ar,bn
RUN yarn build
FROM node:14.17-alpine AS production
# Use the NEXTJS_PORT variable as the PORT if defined, otherwise use PORT.
ENV NEXTJS_PORT=3000
ENV PORT=${NEXTJS_PORT}
ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}
WORKDIR /usr/src/app/
# We need to copy the source code for backend/core and ui-components as well in order
# to ensure that breaking changes in local dependencies from those packages are included
# instead of being pulled from npm.
COPY backend/core ./backend/core
COPY --from=development /usr/src/app/package.json ./package.json
COPY --from=development /usr/src/app/yarn*.lock ./
COPY --from=development /usr/src/app/tsconfig*.json ./
COPY --from=development /usr/src/app/node_modules ./node_modules
WORKDIR /usr/src/app/sites/public
COPY sites/public .
COPY --from=development /usr/src/app/sites/public/next.config.js ./next.config.js
COPY --from=development /usr/src/app/sites/public/public ./public
COPY --from=development /usr/src/app/sites/public/.next ./.next
COPY --from=development /usr/src/app/sites/public/node_modules ./node_modules
EXPOSE ${PORT}
# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry.
# ENV NEXT_TELEMETRY_DISABLED 1
CMD yarn next start -p ${PORT}