-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDockerfile-cron
53 lines (47 loc) · 1.4 KB
/
Dockerfile-cron
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
FROM alpine:3.18
# Build args
ARG CLI_ARGS
ARG CRON_ENTRY
# 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 && \
echo "${CRON_ENTRY} cd /app/nr-reports-cli && node index.js ${CLI_ARGS}" > /crontab.txt && \
/usr/bin/crontab -u pptruser /crontab.txt && \
cd /app/nr-reports-core && \
npm install --production && \
cd /app/nr-reports-cli && \
npm install --production
# Container entry
CMD /usr/sbin/crond -f -l 8 && tail -f /var/log/cron.log