35 lines
913 B
Docker
35 lines
913 B
Docker
|
FROM node:16-alpine AS development
|
||
|
WORKDIR /usr/src/app
|
||
|
COPY --chown=node:node package*.json ./
|
||
|
|
||
|
RUN apk add --no-cache python3 make gcc g++
|
||
|
|
||
|
RUN npm ci
|
||
|
COPY --chown=node:node . .
|
||
|
USER node
|
||
|
|
||
|
FROM node:16-alpine AS build
|
||
|
WORKDIR /usr/src/app
|
||
|
COPY --chown=node:node package*.json ./
|
||
|
COPY --chown=node:node --from=development /usr/src/app/node_modules ./node_modules
|
||
|
COPY --chown=node:node . .
|
||
|
|
||
|
RUN npx -y prisma generate
|
||
|
RUN npm run build
|
||
|
|
||
|
ENV NODE_ENV production
|
||
|
RUN apk add --no-cache python3 make gcc g++
|
||
|
RUN npm ci --omit=dev && npm cache clean --force
|
||
|
USER node
|
||
|
|
||
|
FROM node:16-alpine AS production
|
||
|
WORKDIR /usr/src/app
|
||
|
|
||
|
RUN apk add --no-cache python3
|
||
|
|
||
|
COPY --chown=node:node --from=build /usr/src/app/node_modules ./node_modules
|
||
|
COPY --chown=node:node --from=build /usr/src/app/prisma ./prisma
|
||
|
COPY --chown=node:node --from=build /usr/src/app/dist ./dist
|
||
|
|
||
|
CMD npx -y prisma migrate deploy ; node dist/main.js
|