2022-10-07 08:14:10 +00:00
|
|
|
FROM node:14-bullseye-slim AS base
|
2021-12-29 18:31:46 +00:00
|
|
|
|
|
|
|
ARG NODE_ENV="production"
|
|
|
|
ARG SCULPIN_ENV="prod"
|
|
|
|
ENV NODE_ENV="${NODE_ENV}" \
|
|
|
|
PATH="${PATH}:/node_modules/.bin" \
|
2022-07-22 20:39:49 +00:00
|
|
|
USER="node"
|
2021-12-29 18:31:46 +00:00
|
|
|
|
2022-10-07 08:14:10 +00:00
|
|
|
WORKDIR /app
|
2021-12-29 18:31:46 +00:00
|
|
|
|
|
|
|
RUN mkdir -p /node_modules \
|
|
|
|
&& chown node:node -R /app /node_modules
|
|
|
|
|
2022-10-07 08:14:10 +00:00
|
|
|
###
|
|
|
|
|
|
|
|
FROM base AS build
|
|
|
|
|
2021-12-29 18:31:46 +00:00
|
|
|
USER node
|
|
|
|
|
2022-10-07 08:14:10 +00:00
|
|
|
COPY --chown=node:node *yarn* package.json ./
|
2021-12-29 18:31:46 +00:00
|
|
|
|
|
|
|
RUN yarn install && yarn cache clean
|
|
|
|
|
2022-10-07 08:14:10 +00:00
|
|
|
COPY --chown=node:node . .
|
2021-12-29 18:31:46 +00:00
|
|
|
|
|
|
|
RUN if [ "${NODE_ENV}" != "development" ]; then \
|
2022-10-07 08:14:10 +00:00
|
|
|
yarn build; \
|
2021-12-29 18:31:46 +00:00
|
|
|
else mkdir -p /app/build; fi
|
|
|
|
|
|
|
|
CMD ["bash"]
|
|
|
|
|
|
|
|
###
|
|
|
|
|
2022-01-26 08:47:03 +00:00
|
|
|
FROM alpine AS production
|
|
|
|
|
2022-10-07 08:14:10 +00:00
|
|
|
COPY --from=build /app/dist /app
|
2022-01-26 08:47:03 +00:00
|
|
|
|
2022-10-07 08:14:10 +00:00
|
|
|
CMD ["bash"]
|