2022-05-21 02:23:55 -05:00
|
|
|
# Our Node base image
|
2023-06-16 12:45:05 -05:00
|
|
|
FROM node:18.16.0-alpine3.18@sha256:9036ddb8252ba7089c2c83eb2b0dcaf74ff1069e8ddf86fe2bd6dc5fecc9492d as base
|
2022-05-21 02:23:55 -05:00
|
|
|
|
2022-10-25 14:18:37 -05:00
|
|
|
WORKDIR /usr/src/app
|
2023-02-02 22:28:34 -05:00
|
|
|
EXPOSE 3000
|
|
|
|
RUN apk add --no-cache setpriv
|
2022-05-21 02:23:55 -05:00
|
|
|
|
2023-02-02 22:28:34 -05:00
|
|
|
FROM base as builder
|
2022-10-27 17:21:28 -05:00
|
|
|
|
2023-02-02 22:28:34 -05:00
|
|
|
RUN chown node:node /usr/src/app
|
2022-05-21 02:23:55 -05:00
|
|
|
|
2022-07-13 07:42:00 -05:00
|
|
|
COPY --chown=node:node package*.json ./
|
2022-05-21 02:30:00 -05:00
|
|
|
|
2022-07-04 13:47:25 -05:00
|
|
|
RUN npm ci
|
2022-05-21 02:23:55 -05:00
|
|
|
|
|
|
|
COPY --chown=node:node . .
|
|
|
|
|
|
|
|
EXPOSE 3000
|
|
|
|
|
2023-02-02 22:28:34 -05:00
|
|
|
FROM builder AS dev
|
2022-05-21 02:23:55 -05:00
|
|
|
ENV CHOKIDAR_USEPOLLING=true
|
2022-07-13 07:42:00 -05:00
|
|
|
EXPOSE 24678
|
2022-05-21 02:23:55 -05:00
|
|
|
CMD ["npm", "run", "dev"]
|
|
|
|
|
2023-02-02 22:28:34 -05:00
|
|
|
FROM builder AS prod
|
|
|
|
|
|
|
|
RUN npm run build
|
|
|
|
RUN npm prune --omit=dev
|
|
|
|
|
|
|
|
FROM base
|
|
|
|
|
2022-07-13 07:42:00 -05:00
|
|
|
ENV NODE_ENV=production
|
2023-02-02 22:28:34 -05:00
|
|
|
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
|
|
|
|
COPY --from=prod /usr/src/app/node_modules ./node_modules
|
|
|
|
COPY --from=prod /usr/src/app/build ./build
|
|
|
|
|
|
|
|
COPY package.json package-lock.json ./
|
|
|
|
COPY entrypoint.sh ./
|
2023-05-23 09:02:47 -05:00
|
|
|
|
|
|
|
ENTRYPOINT ["/bin/sh"]
|
|
|
|
|
|
|
|
CMD ["entrypoint.sh"]
|