-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile_tweaked
63 lines (41 loc) · 1.21 KB
/
Dockerfile_tweaked
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
# FROM node:12
# WORKDIR /app
# COPY package.json /app
# RUN npm install
# COPY . /app
# CMD pm2 start app.js
# EXPOSE 7120
FROM node:12-alpine AS BUILD_IMAGE
# couchbase sdk requirements
RUN apk update && apk add curl bash python g++ make && rm -rf /var/cache/apk/*
# install node-prune (https://github.com/tj/node-prune)
RUN curl -sfL https://install.goreleaser.com/github.com/tj/node-prune.sh | bash -s -- -b /usr/local/bin
WORKDIR /app
COPY package.json ./
# install dependencies
# RUN yarn --frozen-lockfile
COPY . .
# lint & test
# RUN yarn lint & yarn test
# build application
# RUN yarn build
RUN npm install
# remove development dependencies
RUN npm prune --production
# run node prune
RUN /usr/local/bin/node-prune
# # 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/couchbase/src/
FROM node:12-alpine
WORKDIR /app
# copy from build image
# COPY --from=BUILD_IMAGE /app/dist ./dist
COPY --from=BUILD_IMAGE /app/node_modules ./node_modules
EXPOSE 7120
# CMD [ "node", "app.js" ]
CMD pm2 start app.js