This commit is contained in:
David Arranz 2024-09-13 17:32:20 +02:00
parent 65f4154b47
commit b6ad452629

View File

@ -41,16 +41,17 @@ ENV LANG es_ES.UTF-8
# Install Google Chrome Stable and fonts # Install Google Chrome Stable and fonts
# Note: this installs the necessary libs to make the browser work with Puppeteer. # Note: this installs the necessary libs to make the browser work with Puppeteer.
RUN apt-get update && apt-get install gnupg wget -y && \ # Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others)
wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg && \ # Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \ # installs, work.
apt-get update && \ RUN apt-get update \
apt-get install google-chrome-stable -y --no-install-recommends && \ && apt-get install -y wget gnupg \
rm -rf /var/lib/apt/lists/* && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
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 && apt-get update \
&& apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \
RUN apt-get -y install ca-certificates fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /api WORKDIR /api
@ -66,22 +67,6 @@ RUN yarn install --production
# Exponer el puerto que la API usa # Exponer el puerto que la API usa
EXPOSE 3001 EXPOSE 3001
#CMD pwd && ls -la
#CMD cat package.json
# Comando para correr la aplicación # Comando para correr la aplicación
#CMD node -r ts-node/register/transpile-only -r tsconfig-paths/register ./server/src/index.js CMD node -r ts-node/register/transpile-only -r tsconfig-paths/register ./server/src/index.js
# Add user so we don't need --no-sandbox.
# same layer as npm install to keep re-chowned files from using up several hundred MBs more space
RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \
&& mkdir -p /home/pptruser/Downloads \
&& chown -R pptruser:pptruser /home/pptruser \
&& chown -R pptruser:pptruser ./node_modules \
&& chown -R pptruser:pptruser ./package.json \
&& chown -R pptruser:pptruser ./yarn.lock
# Run everything after as non-privileged user.
USER pptruser
CMD ["google-chrome-stable"]