forked from Tampere/vuorovaikutusalusta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
69 lines (51 loc) · 1.11 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
##
# Production Dockerfile
##
###
# Base image declaration
###
FROM node:20.5-alpine AS base
ENV APPDIR /app
###
# Client build stage
###
FROM base AS client-build
WORKDIR ${APPDIR}/client
COPY client/package*.json ./
RUN npm ci
COPY interfaces ../interfaces
COPY client ./
RUN npm run build
###
# Server build stage
###
FROM base AS server-build
WORKDIR ${APPDIR}/server
# Tell Puppeteer to skip installing Chrome. We'll be using the installed package.
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
COPY server/package*.json ./
RUN npm ci
COPY interfaces ../interfaces
COPY server ./
RUN npm run build
RUN rm -r src
###
# Main image build
###
FROM base AS main
# Install all dependencies (GDAL & others for Puppeteer)
RUN apk update && apk add \
gdal-tools \
chromium \
nss \
freetype \
harfbuzz \
ca-certificates \
ttf-freefont
WORKDIR ${APPDIR}
COPY --from=server-build ${APPDIR}/server ./
COPY --from=client-build ${APPDIR}/client/dist ./static/
ENV TZ=Europe/Helsinki
# Define Chromium path, as it was not installed in the previous phase
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
CMD npm start