-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
83 lines (61 loc) · 1.72 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# # TODO: NEED TO UPDATE AVAILABLE DATABASE URL
# # Base Stage
# FROM node:18-alpine AS base
# RUN npm install -g pnpm
# # Dependencies Stage
# FROM base AS dependencies
# WORKDIR /home/app
# COPY package.json pnpm-lock.yaml ./
# RUN pnpm install
# # Build Stage
# FROM base AS build
# WORKDIR /home/app
# COPY . .
# COPY --from=dependencies /home/app/node_modules ./node_modules
# RUN npx prisma generate
# RUN pnpm build
# # Deploy Stage
# FROM base AS deploy
# WORKDIR /home/app
# COPY --from=build /home/app/dist ./dist
# COPY --from=build /home/app/node_modules ./node_modules
# # COPY --from=build /home/app/.env ./.env
# # COPY --from=build /home/app/.env.test ./.env.test
# CMD ["node", "dist/main.js"]
# Base Stage
FROM node:18-alpine AS base
RUN npm install -g pnpm
# Dependencies Stage
FROM base AS dependencies
WORKDIR /home/app
COPY package.json pnpm-lock.yaml ./
RUN pnpm install
# Build Stage
FROM base AS build
WORKDIR /home/app
COPY . .
COPY --from=dependencies /home/app/node_modules ./node_modules
RUN npx prisma generate
RUN pnpm build
# Deploy Stage
FROM base AS deploy
ARG API_VERSION
ARG DATABASE_URL
ARG JWT_SECRET
ARG JWT_EXPIRES_IN
ARG MIN_COOKING_TIME
ARG MAX_COOKING_TIME
ARG BUSINESS_NUMBER_CHECK_API_KEY
ENV API_VERSION=$API_VERSION
ENV DATABASE_URL=$DATABASE_URL
ENV JWT_SECRET=$JWT_SECRET
ENV JWT_EXPIRES_IN=$JWT_EXPIRES_IN
ENV MIN_COOKING_TIME=$MIN_COOKING_TIME
ENV MAX_COOKING_TIME=$MAX_COOKING_TIME
ENV BUSINESS_NUMBER_CHECK_API_KEY=$BUSINESS_NUMBER_CHECK_API_KEY
WORKDIR /home/app
COPY --from=build /home/app/dist ./dist
COPY --from=build /home/app/node_modules ./node_modules
# COPY --from=build /home/app/.env ./.env
# COPY --from=build /home/app/.env.test ./.env.test
CMD ["node", "dist/src/main.js"]