2022-10-18 19:28:37 +00:00
|
|
|
FROM node:16-bullseye-slim as deps
|
2021-09-05 17:10:14 +00:00
|
|
|
|
2022-10-18 19:28:37 +00:00
|
|
|
WORKDIR /myapp
|
2022-04-10 15:43:00 +00:00
|
|
|
|
2022-10-18 19:28:37 +00:00
|
|
|
ADD package.json yarn.lock .npmrc ./
|
|
|
|
RUN yarn install
|
2021-09-05 17:10:14 +00:00
|
|
|
|
2022-10-18 19:28:37 +00:00
|
|
|
# Build the app
|
|
|
|
FROM node:16-bullseye-slim as build
|
2021-09-05 17:10:14 +00:00
|
|
|
|
2022-10-18 19:28:37 +00:00
|
|
|
WORKDIR /myapp
|
2021-09-30 15:01:30 +00:00
|
|
|
|
2022-10-18 19:28:37 +00:00
|
|
|
COPY --from=deps /myapp/node_modules /myapp/node_modules
|
2022-04-11 10:58:19 +00:00
|
|
|
|
2022-10-18 19:28:37 +00:00
|
|
|
ADD . .
|
|
|
|
RUN yarn build
|
2022-04-10 15:43:00 +00:00
|
|
|
|
2022-10-18 19:28:37 +00:00
|
|
|
# Finally, build the production image with minimal footprint
|
|
|
|
FROM node:16-bullseye-slim
|
2022-04-10 15:43:00 +00:00
|
|
|
|
2022-10-18 19:28:37 +00:00
|
|
|
ENV PORT="8080"
|
|
|
|
ENV NODE_ENV="production"
|
2022-04-10 15:43:00 +00:00
|
|
|
|
2022-10-18 19:28:37 +00:00
|
|
|
WORKDIR /myapp
|
2022-04-10 15:43:00 +00:00
|
|
|
|
2022-10-18 19:28:37 +00:00
|
|
|
COPY --from=deps /myapp/node_modules /myapp/node_modules
|
2022-04-10 15:43:00 +00:00
|
|
|
|
2022-10-18 19:28:37 +00:00
|
|
|
COPY --from=build /myapp/build /myapp/build
|
|
|
|
COPY --from=build /myapp/public /myapp/public
|
|
|
|
COPY --from=build /myapp/package.json /myapp/package.json
|
2022-03-24 12:54:47 +00:00
|
|
|
|
2022-10-18 19:28:37 +00:00
|
|
|
ENTRYPOINT [ "yarn", "start" ]
|