-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDockerfile
51 lines (44 loc) · 1.23 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
FROM alpine:3.18
# Install required packages
RUN apk add --no-cache \
chromium \
nss \
freetype \
harfbuzz \
ca-certificates \
ttf-freefont \
nodejs \
yarn
# Install node and make the app root
RUN apk add --no-cache \
chromium \
nss \
freetype \
harfbuzz \
ca-certificates \
ttf-freefont \
nodejs \
yarn \
nodejs \
npm
# Copy function code
COPY nr-reports-core /app/nr-reports-core/
COPY nr-reports-cli /app/nr-reports-cli/
COPY templates /app/nr-reports-cli/templates/
COPY include /app/nr-reports-cli/include/
# Tell Puppeteer to skip installing Chrome. We'll be using the installed package.
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
# Add user so we don't need --no-sandbox.
RUN addgroup -S pptruser && adduser -S -g pptruser pptruser \
&& mkdir -p /home/pptruser/Downloads /app \
&& chown -R pptruser:pptruser /home/pptruser \
&& chown -R pptruser:pptruser /app && \
cd /app/nr-reports-core && \
npm install --production && \
cd /app/nr-reports-cli && \
npm install --production
WORKDIR /app/nr-reports-cli
USER pptruser
# Container entry
ENTRYPOINT ["node", "index.js"]