-
Notifications
You must be signed in to change notification settings - Fork 20
/
Dockerfile
91 lines (59 loc) · 1.73 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
ARG APT_FLAGS="-y -qq --no-install-recommends --no-install-suggests"
FROM node:16-bullseye-slim AS base
# We don't need the standalone Chromium
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ARG APT_FLAGS
ARG COMMON_PACKAGES="\
curl \
gnupg \
ca-certificates \
make \
"
RUN mkdir -p /usr/share/man/man1
# Install Google Chrome Stable and fonts
# Note: this installs the necessary libs to make the browser work with Puppeteer.
RUN apt-get update && apt-get install ${APT_FLAGS} ${COMMON_PACKAGES} -y \
&& curl --location --silent https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y \
google-chrome-stable \
fonts-ipafont-gothic \
fonts-wqy-zenhei \
fonts-thai-tlwg \
fonts-kacst \
fonts-freefont-ttf \
libxss1 -y --no-install-recommends \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN ln -s /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1
FROM base as packages
WORKDIR /build
RUN chown node:node /build
USER node
# Ensure artefacts folders permissions
RUN mkdir dist node_modules
COPY package*.json ./
RUN npm ci --only=production
RUN cp -a node_modules production_modules
RUN npm ci --silent --only=dev
# Dev stage
FROM packages as dev
USER root
ENV NODE_ENV development
USER node
WORKDIR /build
COPY . .
# Build stage
FROM packages as build
COPY --from=dev /build/ .
RUN npm run build
# Final Image
FROM base
ENV NODE_ENV production
USER node
WORKDIR /app
COPY package.json .
COPY --from=build /build/dist dist
COPY --from=packages /build/production_modules node_modules
CMD node dist