-
Notifications
You must be signed in to change notification settings - Fork 9
/
Dockerfile
36 lines (26 loc) · 774 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Dependencies
FROM node:19-alpine3.17 AS dependencies
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install
# Build
FROM node:19-alpine3.17 AS build
WORKDIR /app
COPY --from=dependencies /app/node_modules ./node_modules
COPY . .
RUN npx prisma generate && npm run build
# Deploy
FROM node:19-alpine3.17 as deploy
WORKDIR /app
ENV NODE_ENV production
# Add mysql precheck
RUN apk add --no-cache mysql-client
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
# Copy files
COPY --from=build /app/package.json ./
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/prisma ./prisma
COPY --from=build /app/dist ./dist
ENTRYPOINT [ "/docker-entrypoint.sh" ]
CMD [ "npm", "run", "start:migrate:prod" ]