Updated dockerfile & build for dockerized puppeteer
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
bc2b6fadd9
commit
ea8028dfd5
33
Dockerfile
33
Dockerfile
@ -8,9 +8,32 @@ COPY tsconfig.json ./
|
|||||||
COPY src ./src
|
COPY src ./src
|
||||||
RUN pnpm run build
|
RUN pnpm run build
|
||||||
# final image
|
# 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 ./
|
COPY package.json ./
|
||||||
RUN npm i -g pnpm
|
RUN yarn
|
||||||
RUN pnpm i --prod
|
COPY --from=0 /app/dist app
|
||||||
COPY --from=0 /app/dist dist
|
ENTRYPOINT ["node", "app/app.js"]
|
||||||
ENTRYPOINT ["node", "dist/app.js"]
|
|
@ -5,7 +5,7 @@
|
|||||||
"main": "src/app.ts",
|
"main": "src/app.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "nodemon src/app.ts",
|
"dev": "nodemon src/app.ts",
|
||||||
"build": "rimraf ./dist && tsc",
|
"build": "rimraf ./dist && tsc && cp-cli ./src/templates ./dist/templates",
|
||||||
"licenses:export": "license-exporter --markdown",
|
"licenses:export": "license-exporter --markdown",
|
||||||
"release": "release-it --only-version",
|
"release": "release-it --only-version",
|
||||||
"translations:sort": "node sort_translations.js"
|
"translations:sort": "node sort_translations.js"
|
||||||
@ -63,6 +63,7 @@
|
|||||||
"@types/express": "^4.17.11",
|
"@types/express": "^4.17.11",
|
||||||
"@types/node": "^14.14.22",
|
"@types/node": "^14.14.22",
|
||||||
"@types/puppeteer": "^5.4.3",
|
"@types/puppeteer": "^5.4.3",
|
||||||
|
"cp-cli": "^2.0.0",
|
||||||
"nodemon": "^2.0.7",
|
"nodemon": "^2.0.7",
|
||||||
"release-it": "^14.2.2",
|
"release-it": "^14.2.2",
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
|
@ -64,7 +64,8 @@ export class PdfCreator {
|
|||||||
'--no-pings',
|
'--no-pings',
|
||||||
'--no-zygote',
|
'--no-zygote',
|
||||||
'--password-store=basic',
|
'--password-store=basic',
|
||||||
'--use-gl=swiftshader'
|
'--use-gl=swiftshader',
|
||||||
|
'--no-sandbox'
|
||||||
];
|
];
|
||||||
|
|
||||||
await i18next
|
await i18next
|
||||||
|
Loading…
x
Reference in New Issue
Block a user