🚧 Dockerfile changes

This commit is contained in:
Axel Olausson Holtenäs 2022-10-23 17:51:33 +02:00
parent 32cdeced8e
commit 83d3e4f150
No known key found for this signature in database
GPG key ID: BEDBB4D61E6C8462

View file

@ -1,32 +1,24 @@
FROM node:19 AS builder
WORKDIR /usr
COPY tsconfig.json ./
COPY src ./src
# Create app directory
WORKDIR /app
# A wildcard is used to ensure both package.json AND package-lock.json are copied
COPY package*.json ./
COPY prisma ./prisma/
RUN ls -a
# Install app dependencies
RUN npm install
COPY . .
RUN npm run build
## this is stage two , where the app actually runs
FROM node:19
WORKDIR /usr
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/dist ./dist
COPY --from=builder /usr/package*.json ./
COPY --from=builder /usr/dist ./dist
RUN npm install --omit=dev
CMD ["node","dist/index.js"]
EXPOSE 3000
CMD [ "npm", "run", "start:prod" ]