2023-06-24 20:38:34 +00:00
|
|
|
FROM node:18 as builder
|
2023-06-20 20:05:15 +00:00
|
|
|
|
|
|
|
# Create app dir
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
COPY package*.json ./
|
|
|
|
COPY prisma ./prisma/
|
|
|
|
|
2023-06-24 20:38:34 +00:00
|
|
|
RUN npm install -D @swc/cli @swc/core
|
2023-06-20 20:05:15 +00:00
|
|
|
RUN npm install
|
|
|
|
|
|
|
|
COPY . .
|
|
|
|
|
2023-06-23 18:15:11 +00:00
|
|
|
RUN npm run build
|
|
|
|
|
|
|
|
# Stage 2
|
2023-06-24 20:38:34 +00:00
|
|
|
FROM node:18
|
2023-06-23 18:15:11 +00:00
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
2023-06-24 20:38:34 +00:00
|
|
|
RUN npm i pm2 -g
|
|
|
|
|
2023-06-23 18:15:11 +00:00
|
|
|
COPY --from=builder /app/package*.json ./
|
|
|
|
COPY --from=builder /app/prisma ./prisma/
|
|
|
|
COPY --from=builder /app/dist ./dist/
|
|
|
|
|
|
|
|
RUN npm ci
|
|
|
|
|
2023-07-20 11:15:29 +00:00
|
|
|
RUN npm run prisma:deploy
|
|
|
|
|
2023-06-20 20:05:15 +00:00
|
|
|
EXPOSE 8080
|
|
|
|
|
|
|
|
CMD ["npm", "run", "prod:start"]
|