You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.4 KiB

# ################################################################
# ### Base image ###
# ################################################################
FROM node:16-alpine as base
WORKDIR /opt
COPY . .
WORKDIR /opt/app
ARG NODE_ENV=production
ENV NODE_ENV ${NODE_ENV}
# ################################################################
# ### development image ###
# ################################################################
FROM base as development
RUN npm install --quiet --unsafe-perm --no-progress --no-audit --include=dev
CMD npm run run:dev
# ################################################################
# ### backend build image ###
# ################################################################
FROM base as backendbuild
RUN npm install --quiet --unsafe-perm --no-progress --no-audit --include=dev
RUN npx tsc -p ./tsconfig.json
# ################################################################
# ### production image ###
# ################################################################
FROM base as production
COPY --from=backendbuild --chown=node:node /opt/app/dist/ /opt/app/dist/
RUN npm install --quiet --unsafe-perm --no-progress --no-audit --omit=dev
CMD npm run run:prod