Skip to content
Snippets Groups Projects
Commit a4e246cf authored by michael.minelli's avatar michael.minelli
Browse files

Dockerfile => Update with multi-stage and Prisma support

parent c6a602b7
No related branches found
No related tags found
No related merge requests found
FROM node:20-bullseye ARG BUILD_WORKDIR=/dojo/ExpressAPI
######################################################################## Build stage
FROM node:20-bullseye AS builder
LABEL maintainer="Michaël Minelli <michael-jean.minelli@hesge.ch>" LABEL maintainer="Michaël Minelli <michael-jean.minelli@hesge.ch>"
LABEL Description="Express API for Dojo" LABEL Description="Express API for Dojo - Build stage"
ARG BUILD_WORKDIR
ADD ExpressAPI/ /dojo/ExpressAPI/ # Create app directory
ADD .env /dojo/ExpressAPI/.env ADD ExpressAPI/ ${BUILD_WORKDIR}/
WORKDIR /dojo/ExpressAPI/ WORKDIR ${BUILD_WORKDIR}
# Install app dependencies
RUN npm install RUN npm install
# Build app
RUN npm run build RUN npm run build
######################################################################## Run stage
FROM node:20-bullseye
LABEL maintainer="Michaël Minelli <michael-jean.minelli@hesge.ch>"
LABEL Description="Express API for Dojo - Run stage"
ARG BUILD_WORKDIR
COPY --from=builder ${BUILD_WORKDIR}/node_modules ./node_modules
COPY --from=builder ${BUILD_WORKDIR}/package*.json ./
COPY --from=builder ${BUILD_WORKDIR}/dist ./dist
COPY --from=builder ${BUILD_WORKDIR}/prisma ./prisma
ADD .env ${BUILD_WORKDIR}/.env
EXPOSE 30992 EXPOSE 30992
ENTRYPOINT [ "npm", "run", "start:prod" ] CMD [ "npm", "run", "start:migrate:prod" ]
#ENTRYPOINT ["tail", "-f", "/dev/null"] #ENTRYPOINT ["tail", "-f", "/dev/null"]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment