grungnet/backend/Dockerfile

31 lines
933 B
Docker
Raw Normal View History

FROM node:16.20.0-alpine3.18 AS builder
2023-01-15 20:02:32 -05:00
RUN mkdir /home/node/app/ && chown -R node:node /home/node/app
WORKDIR /home/node/app
COPY --chown=node:node package.json ./
COPY --chown=node:node yarn.lock ./
USER node
RUN yarn install --non-interactive --dev && yarn cache clean
COPY ./src/ ./src
COPY ./tsconfig.json ./
RUN yarn run build
FROM builder AS install
ENV NODE_ENV production
WORKDIR /home/node/app
RUN rm -rf ./node_modules && yarn install --non-interactive --prod --frozen-lockfile && yarn cache clean
FROM node:16.20.0-alpine3.18
2023-01-15 20:02:32 -05:00
USER node
ENV NODE_ENV production
WORKDIR /home/node/app
COPY --chown=node:node package.json ./
COPY --chown=node:node yarn.lock ./
COPY --chown=node:node ice.json ./
2023-01-15 20:02:32 -05:00
COPY --chown=node:node --from=builder /home/node/app/build ./build
COPY --chown=node:node --from=install /home/node/app/node_modules ./node_modules
CMD ["node", "--es-module-specifier-resolution=node", "./build/index.js"]