-
Notifications
You must be signed in to change notification settings - Fork 23
/
Dockerfile
65 lines (43 loc) · 1.45 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
### Build web files
FROM node:21-alpine AS web-build
WORKDIR /app/web
COPY ["web/package.json", "web/package-lock.json*", "./"]
RUN npm install
COPY ./interfaces /app/interfaces
COPY ./web .
RUN npm run build
### Download server npm modules
FROM node:21-alpine AS server-build
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true"
WORKDIR /app/server
COPY ["server/package.json", "server/package-lock.json*", "./"]
RUN npm install
COPY ./interfaces /app/interfaces
COPY ./server .
RUN npm run build
# Prepare node_modules for docker
RUN npm prune --production
RUN apk update && \
apk add curl && \
curl -sf https://gobinaries.com/tj/node-prune | sh
# The mv is a workaround for this - https://github.com/tj/node-prune/issues/63
RUN mv node_modules/googleapis/build/src/apis/docs ./docs && \
node-prune --exclude "**/googleapis/**/docs/*.js" && \
mv ./docs node_modules/googleapis/build/src/apis/docs
### Build final image
FROM node:21-alpine
USER root
ENV RUNNING_IN_DOCKER="true"
WORKDIR /app/server
# Install Chromium
RUN apk update && \
apk add --no-cache nss udev ttf-freefont chromium nginx && \
rm -rf /var/cache/apk/* /tmp/*
COPY ./assets/nginx.conf /etc/nginx/nginx.conf
COPY ./assets/entrypoint.sh .
RUN chmod 755 entrypoint.sh
COPY --from=web-build /app/web/dist /var/www/html
COPY --from=server-build /app/server/node_modules ./node_modules
COPY --from=server-build /app/server/build ./build
EXPOSE 80
ENTRYPOINT ["./entrypoint.sh"]