Created
August 2, 2022 13:25
-
-
Save wodCZ/447bd4639f621d72d5e17c6a4e86dcde to your computer and use it in GitHub Desktop.
Nest.js + Prisma Dockerfile - possibly smallest image size
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:18-alpine as build | |
WORKDIR /app | |
RUN yarn global add @vercel/ncc | |
COPY package.json yarn.lock ./ | |
RUN yarn install | |
COPY . . | |
RUN ./node_modules/.bin/prisma generate && yarn run build && ncc build dist/src/main.js -o build | |
FROM node:18-alpine as production | |
ARG NODE_ENV=production | |
ENV NODE_ENV $NODE_ENV | |
ARG PORT=3000 | |
ENV PORT $PORT | |
EXPOSE $PORT | |
WORKDIR /app | |
COPY --chown=node:node --from=build /app/build ./ | |
USER node | |
CMD [ "node", "index.js" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment