-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile
More file actions
64 lines (42 loc) · 1.33 KB
/
Copy pathdockerfile
File metadata and controls
64 lines (42 loc) · 1.33 KB
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
FROM node:18.17.0-alpine AS builder
RUN apk add curl bash
RUN curl -sf https://gobinaries.com/tj/node-prune | bash -s -- -b /usr/local/bin
WORKDIR /app
COPY package*.json ./
COPY yarn.lock ./
COPY prisma ./prisma/
RUN yarn
COPY . .
ENV NODE_OPTIONS="--max_old_space_size=4096"
RUN yarn run build
# run node prune
RUN /usr/local/bin/node-prune
# RUN npm prune --production
RUN yarn install --production --ignore-scripts --prefer-offline
# remove unused dependencies
RUN rm -rf node_modules/rxjs/src/
RUN rm -rf node_modules/rxjs/bundles/
RUN rm -rf node_modules/rxjs/_esm5/
RUN rm -rf node_modules/rxjs/_esm2015/
RUN rm -rf node_modules/swagger-ui-dist/*.map
RUN rm -rf node_modules/aws-sdk/dist/
# RUN npm prune --production
FROM node:18.17.0-alpine AS deploy
RUN apk update && apk add bash
WORKDIR /app
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/yarn.lock ./
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/prisma ./prisma
COPY --from=builder /app/public ./public
COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh
ARG ARG_PORT
ENV PORT=$ARG_PORT
ARG RUN_MIGRATION
ENV RUN_MIGRATION=$RUN_MIGRATION
ARG ARG_RUN_SEED
ENV RUN_SEED=$ARG_RUN_SEED
EXPOSE $PORT
ENTRYPOINT [ "/entrypoint.sh" ]