-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
41 lines (32 loc) · 938 Bytes
/
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
FROM node:12.13.1-alpine AS Builder
WORKDIR /tmp
COPY common/ ./common/
COPY server/ ./server/
COPY ui/ ./ui/
COPY .eslintrc.js ./
COPY package.json ./
COPY yarn.lock ./
RUN yarn install \
&& cd ui \
&& yarn build \
&& cd ../server \
&& yarn build
FROM node:12.13.1-alpine
ARG DATA_DIR=/data
WORKDIR /app
COPY package.json ./
COPY server/report-demo.json ./server/report-demo.json
COPY --from=Builder /tmp/node_modules/ ./node_modules/
COPY --from=Builder /tmp/server/node_modules ./server/node_modules/
COPY --from=Builder /tmp/dist/ ./dist/
COPY --from=Builder /tmp/build/common/ ./common/
COPY --from=Builder /tmp/build/server/src/ ./server/
COPY --from=Builder /tmp/server/package.json ./server
ENV PORT 80
ENV LOG_LEVEL INFO
ENV PUBLIC_DIR /app/dist
ENV DATA_DIR "${DATA_DIR}"
EXPOSE 80
VOLUME ${DATA_DIR}
WORKDIR /app/server
CMD [ "node", "--require", "dotenv/config", "--require", "module-alias/register", "main.js" ]