-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.build
30 lines (29 loc) · 1.02 KB
/
Dockerfile.build
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
FROM node:lts-alpine3.16 as dependencies
RUN apk add --no-cache --virtual .gyp python3 make gcc g++
RUN mkdir /home/app
WORKDIR /home/app
COPY ["package.json","package-lock.json","tsconfig.json","tsconfig.build.json","./"]
RUN npm install && apk del .gyp
COPY ["src","./src"]
RUN npm run build
RUN rm -rf node_modules
RUN npm cache verify
RUN npm install --only=production
RUN npm prune --production
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
FROM node:lts-alpine3.16 as release
ENV NODE_ENV production
RUN apk add --no-cache tzdata
# ENV TZ Africa/Dar_es_Salaam
# RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN mkdir /home/app
WORKDIR /home/app
RUN apk add --no-cache curl
COPY --from=dependencies /home/app/dist/ ./
COPY --from=dependencies /home/app/node_modules ./node_modules
COPY --from=dependencies /home/app/package.json ./package.json
CMD node main