-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
111 lines (80 loc) · 2.91 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# build source code
FROM alpine:3.10.0 AS builder
RUN apk add --update nodejs nodejs-npm
COPY ./src /home/node/app/src
COPY ./package.json /home/node/app/package.json
COPY ./nest-cli.json /home/node/app/nest-cli.json
COPY ./tsconfig.json /home/node/app/tsconfig.json
COPY ./tsconfig.build.json /home/node/app/tsconfig.build.json
COPY ./app.config.json /home/node/app/app.config.json
WORKDIR /home/node/app
RUN npm install
RUN npm run prestart:prod
# download only production dependency
FROM alpine:3.10.0 AS dependency
RUN apk add --update nodejs nodejs-npm
COPY ./package.json /home/node/app/package.json
WORKDIR /home/node/app
RUN npm install --production
# runtimes
# 7zip
FROM alpine:3.10.0 as p7zip
RUN apk add --update p7zip
RUN apk add --update nodejs
COPY --from=builder /home/node/app/dist /home/node/app/dist
COPY --from=dependency /home/node/app/node_modules /home/node/app/node_modules
COPY ./app.config.json /home/node/app/dist/app.config.json
COPY ./package.json /home/node/app/package.json
RUN mkdir /home/node/data
RUN mkdir /home/node/secret
RUN mkdir /home/node/temp
ENV SOURCE_FOLDER=/home/node/backup
ENV GOOGLE_IDS_FILE=/home/node/secret/client_secret.json
ENV PATH_TO_GOOGLE_TOKENS=/home/node/secret/token_secret.json
ENV PATH_TEMP_COMPRESS_FILE_FILDER=/home/node/temp
ENV TARGET_FOLDER_NAME=server_backup
ENV COMPRESS_TYPE=7ZIP
ENV NODE_ENV=production
WORKDIR /home/node/app/dist
CMD node main.js
# tar
FROM alpine:3.10.0 as tar
RUN apk add --update tar
RUN apk add --update nodejs
COPY --from=builder /home/node/app/dist /home/node/app/dist
COPY --from=dependency /home/node/app/node_modules /home/node/app/node_modules
COPY ./app.config.json /home/node/app/dist/app.config.json
COPY ./package.json /home/node/app/package.json
RUN mkdir /home/node/data
RUN mkdir /home/node/secret
RUN mkdir /home/node/temp
ENV SOURCE_FOLDER=/home/node/backup
ENV GOOGLE_IDS_FILE=/home/node/secret/client_secret.json
ENV PATH_TO_GOOGLE_TOKENS=/home/node/secret/token_secret.json
ENV PATH_TEMP_COMPRESS_FILE_FILDER=/home/node/temp
ENV TARGET_FOLDER_NAME=server_backup
ENV COMPRESS_TYPE=TARBZ2
ENV NODE_ENV=production
WORKDIR /home/node/app/dist
CMD node main.js
# tar
FROM alpine:3.10.0 as tar_7zip
RUN apk add --update tar
RUN apk add --update p7zip
RUN apk add --update nodejs
COPY --from=builder /home/node/app/dist /home/node/app/dist
COPY --from=dependency /home/node/app/node_modules /home/node/app/node_modules
COPY ./app.config.json /home/node/app/dist/app.config.json
COPY ./package.json /home/node/app/package.json
RUN mkdir /home/node/data
RUN mkdir /home/node/secret
RUN mkdir /home/node/temp
ENV SOURCE_FOLDER=/home/node/backup
ENV GOOGLE_IDS_FILE=/home/node/secret/client_secret.json
ENV PATH_TO_GOOGLE_TOKENS=/home/node/secret/token_secret.json
ENV PATH_TEMP_COMPRESS_FILE_FILDER=/home/node/temp
ENV TARGET_FOLDER_NAME=server_backup
ENV COMPRESS_TYPE=TARBZ2
ENV NODE_ENV=production
WORKDIR /home/node/app/dist
CMD node main.js