-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
62 lines (45 loc) · 1.47 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
FROM node:14-buster as dependencies
LABEL MAINTAINER="Ulrich Van Den Hekke <[email protected]>"
WORKDIR /src/server
COPY server/package.json /src/server
COPY server/package-lock.json /src/server
RUN npm install --production
#
# -------- Build --------
FROM dependencies as build
WORKDIR /src/client
COPY client/package.json /src/client
COPY client/package-lock.json /src/client
RUN npm install
WORKDIR /src/server
RUN npm install
COPY client/ /src/client/
COPY server/ /src/server/
WORKDIR /src/client
ENV VUE_APP_GRAPHQL_HTTP=/graphql
RUN npm run build -- --prod
WORKDIR /src/server
RUN npm run build
#
# -------- Dist -----------
FROM node:14-buster AS dist
RUN apt update && apt install -y btrfs-compsize btrfs-progs coreutils samba-common-bin rsync && rm -rf /var/lib/apt/lists/*
WORKDIR /server
RUN mkdir -p /root/.ssh && chmod 700 /root/.ssh
RUN echo "IdentityFile /backups/.ssh/id_rsa" >> /root/.ssh/config
RUN echo "StrictHostKeyChecking=no" >> /root/.ssh/config
RUN mkdir -p /backups/.ssh && chmod 700 /backups/.ssh
COPY --from=dependencies /src/server/node_modules /server/node_modules
COPY --from=build /src/server/config/ /server/config/
COPY --from=build /src/server/dist/ /server/
COPY --from=build /src/client/dist /server/client/
ENV STATIC_PATH=/server/client/
ENV NODE_ENV=production
ENV BACKUP_PATH=/backups
ENV LOG_LEVEL=info
ENV REDIS_HOST=redis
ENV REDIS_PORT=6379
ENV VUE_APP_GRAPHQL_HTTP=/graphql
ENTRYPOINT [ "node" ]
CMD [ "/server/main.js" ]
EXPOSE 3000