Updated dockerfile & build for dockerized puppeteer
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Nicolai Ort 2021-02-07 17:51:36 +01:00
parent bc2b6fadd9
commit ea8028dfd5
3 changed files with 33 additions and 8 deletions

View File

@ -8,9 +8,32 @@ COPY tsconfig.json ./
COPY src ./src
RUN pnpm run build
# final image
FROM node:14.15.1-alpine3.12
FROM alpine:edge
WORKDIR /app
RUN apk add --no-cache \
chromium \
nss \
freetype \
freetype-dev \
harfbuzz \
ca-certificates \
ttf-freefont \
nodejs \
yarn
# 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
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
# Run everything after as non-privileged user.
USER pptruser
COPY package.json ./
RUN npm i -g pnpm
RUN pnpm i --prod
COPY --from=0 /app/dist dist
ENTRYPOINT ["node", "dist/app.js"]
RUN yarn
COPY --from=0 /app/dist app
ENTRYPOINT ["node", "app/app.js"]

View File

@ -5,7 +5,7 @@
"main": "src/app.ts",
"scripts": {
"dev": "nodemon src/app.ts",
"build": "rimraf ./dist && tsc",
"build": "rimraf ./dist && tsc && cp-cli ./src/templates ./dist/templates",
"licenses:export": "license-exporter --markdown",
"release": "release-it --only-version",
"translations:sort": "node sort_translations.js"
@ -63,6 +63,7 @@
"@types/express": "^4.17.11",
"@types/node": "^14.14.22",
"@types/puppeteer": "^5.4.3",
"cp-cli": "^2.0.0",
"nodemon": "^2.0.7",
"release-it": "^14.2.2",
"rimraf": "^3.0.2",
@ -82,4 +83,4 @@
"publish": false
}
}
}
}

View File

@ -64,7 +64,8 @@ export class PdfCreator {
'--no-pings',
'--no-zygote',
'--password-store=basic',
'--use-gl=swiftshader'
'--use-gl=swiftshader',
'--no-sandbox'
];
await i18next