2021-12-03 14:36:08 +00:00
|
|
|
FROM node:16-buster AS builder
|
2021-04-20 13:59:31 +00:00
|
|
|
|
|
|
|
# this is a bit clunky, perhaps there's a more concise way of passing in build
|
|
|
|
# arguments
|
|
|
|
ARG FREECODECAMP_NODE_ENV
|
|
|
|
ARG HOME_LOCATION
|
|
|
|
ARG API_LOCATION
|
|
|
|
ARG FORUM_LOCATION
|
|
|
|
ARG NEWS_LOCATION
|
|
|
|
ARG CLIENT_LOCALE
|
|
|
|
ARG CURRICULUM_LOCALE
|
|
|
|
ARG ALGOLIA_APP_ID
|
|
|
|
ARG ALGOLIA_API_KEY
|
2021-08-08 20:22:25 +00:00
|
|
|
ARG STRIPE_PUBLIC_KEY
|
2021-04-20 13:59:31 +00:00
|
|
|
ARG PAYPAL_CLIENT_ID
|
|
|
|
ARG DEPLOYMENT_ENV
|
|
|
|
ARG SHOW_UPCOMING_CHANGES
|
|
|
|
|
|
|
|
# node images create a non-root user that we can use
|
|
|
|
USER node
|
|
|
|
WORKDIR /home/node/build
|
|
|
|
COPY --chown=node:node . .
|
|
|
|
RUN npm ci
|
2022-01-25 10:34:16 +00:00
|
|
|
# we don't need to separately run create:config, since it gets called as part of
|
2021-04-20 13:59:31 +00:00
|
|
|
# build:client
|
|
|
|
RUN npm run build:client
|
|
|
|
|
|
|
|
WORKDIR /home/node/config
|
|
|
|
RUN git clone https://github.com/freeCodeCamp/client-config.git client
|
|
|
|
|
2021-12-03 14:36:08 +00:00
|
|
|
FROM node:16-alpine
|
2021-04-20 13:59:31 +00:00
|
|
|
RUN npm i -g serve
|
|
|
|
USER node
|
|
|
|
WORKDIR /home/node
|
|
|
|
COPY --from=builder /home/node/build/client/public/ client/public
|
|
|
|
COPY --from=builder /home/node/config/client/serve.json client
|
|
|
|
COPY --from=builder /home/node/config/client/www/ client
|
|
|
|
|
|
|
|
ENTRYPOINT ["serve", "-c", "../serve.json", "client/public"]
|
|
|
|
CMD ["-l", "8000"]
|