This commit is contained in:
David Arranz 2024-09-13 16:29:07 +02:00
parent 9970331856
commit c22b5fba75
2 changed files with 18 additions and 15 deletions

View File

@ -3,21 +3,6 @@
# BUILD STAGE
FROM node:lts-iron AS builder
# Configure default locale (important for chrome-headless-shell).
ENV LANG es_ES.UTF-8
# We don't need the standalone Chromium
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
# 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 libnss3 gnupg wget -y && \
wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg && \
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 google-chrome-stable -y --no-install-recommends && \
rm -rf /var/lib/apt/lists/*
# Establecer el directorio de trabajo
WORKDIR /api
@ -48,6 +33,23 @@ COPY server/src/contexts/sales/infrastructure/express/controllers/quotes/reportQ
# FINAL STAGE (Producción)
FROM node:lts-iron AS prod
# Configure default locale (important for chrome-headless-shell).
ENV LANG es_ES.UTF-8
# We don't need the standalone Chromium
#ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
# 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 libnss3 gnupg wget -y && \
# wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg && \
# 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 google-chrome-stable -y --no-install-recommends && \
# rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 libgbm1 libasound2 libcairo2 libpango-1.0-0
WORKDIR /api
# Copiar los archivos del build desde la fase anterior

View File

@ -34,6 +34,7 @@ export const ReportQuotePresenter: IReportQuoteReporter = {
// Generar el PDF con Puppeteer
const browser = await puppeteer.launch({
args: [
"--disable-extensions",
"--no-sandbox",
"--disable-setuid-sandbox",
"--disable-dev-shm-usage",