-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.api
49 lines (34 loc) · 1.91 KB
/
Dockerfile.api
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
FROM node:16.13.1-alpine as server_dist
WORKDIR /server_dist
#- Only copy over the packages files of all required packages.
#- This will ensure that we don't have to install all dependencies
#- again if any source files change.
COPY package*.json lerna.json ./
COPY packages/api/package*.json ./packages/api/
COPY packages/database/ ./packages/database/
#- Install dependencies and bootstrap packages
RUN npm ci --unsafe-perm
#- Now copy over source files and assets
COPY packages/api/src ./packages/api/src
COPY packages/api/tsconfig.json ./packages/api/
RUN npm run api:build
FROM node:16.13.1-alpine as server_dist2
WORKDIR /server_dist2/
COPY --from=server_dist /server_dist/packages/api/src ./packages/api/src
COPY --from=server_dist /server_dist/packages/api/dist ./packages/api/dist
COPY --from=server_dist /server_dist/packages/api/tsconfig.json ./packages/api/
COPY --from=server_dist /server_dist/packages/api/package*.json ./packages/api/
COPY --from=server_dist /server_dist/packages/database/dist ./packages/database/dist
COPY --from=server_dist /server_dist/packages/database/package*.json ./packages/database/
COPY --from=server_dist /server_dist/packages/database/prisma ./packages/database/prisma
# COPY --from=server_dist /server_dist/packages/core/dist ./packages/core/dist
COPY package*.json lerna.json ./
RUN npm -g install lerna@5.1.8
RUN npm config set ignore-scripts true && npm install --production
RUN npm config set ignore-scripts true && lerna bootstrap -- --production
# COPY --from=server_dist /server_dist/packages/database/node_modules/ ./packages/database/node_modules/
COPY --from=server_dist /server_dist/packages/database/node_modules/.prisma ./packages/database/node_modules/.prisma
COPY --from=server_dist /server_dist/packages/api/node_modules/bcrypt/ ./packages/api/node_modules/bcrypt/
RUN npm run generate
EXPOSE 3010
CMD ["sh", "-c", "npm run db:migrate:deploy && node packages/api/dist/main.js"]