2022-05-21 00:23:55 -07:00
|
|
|
# Our Node base image
|
2023-10-03 07:34:35 -07:00
|
|
|
FROM node:20.8-alpine3.18 as base
|
2022-05-21 00:23:55 -07:00
|
|
|
|
2022-10-25 12:18:37 -07:00
|
|
|
WORKDIR /usr/src/app
|
2023-02-02 20:28:34 -07:00
|
|
|
EXPOSE 3000
|
2023-07-21 07:20:04 -07:00
|
|
|
RUN apk add --no-cache setpriv tini
|
2022-05-21 00:23:55 -07:00
|
|
|
|
2023-02-02 20:28:34 -07:00
|
|
|
FROM base as builder
|
2022-10-27 15:21:28 -07:00
|
|
|
|
2023-02-02 20:28:34 -07:00
|
|
|
RUN chown node:node /usr/src/app
|
2022-05-21 00:23:55 -07:00
|
|
|
|
2022-07-13 05:42:00 -07:00
|
|
|
COPY --chown=node:node package*.json ./
|
2022-05-21 00:30:00 -07:00
|
|
|
|
2022-07-04 11:47:25 -07:00
|
|
|
RUN npm ci
|
2022-05-21 00:23:55 -07:00
|
|
|
|
|
|
|
COPY --chown=node:node . .
|
|
|
|
|
|
|
|
EXPOSE 3000
|
|
|
|
|
2023-02-02 20:28:34 -07:00
|
|
|
FROM builder AS dev
|
2022-05-21 00:23:55 -07:00
|
|
|
ENV CHOKIDAR_USEPOLLING=true
|
2022-07-13 05:42:00 -07:00
|
|
|
EXPOSE 24678
|
2022-05-21 00:23:55 -07:00
|
|
|
CMD ["npm", "run", "dev"]
|
|
|
|
|
2023-02-02 20:28:34 -07:00
|
|
|
FROM builder AS prod
|
|
|
|
|
|
|
|
RUN npm run build
|
|
|
|
RUN npm prune --omit=dev
|
|
|
|
|
|
|
|
FROM base
|
|
|
|
|
2022-07-13 05:42:00 -07:00
|
|
|
ENV NODE_ENV=production
|
2023-02-02 20:28:34 -07: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 07:02:47 -07:00
|
|
|
|
2023-07-21 07:20:04 -07:00
|
|
|
ENTRYPOINT ["tini", "--", "/bin/sh"]
|
2023-05-23 07:02:47 -07:00
|
|
|
|
|
|
|
CMD ["entrypoint.sh"]
|