counteryflag / Dockerfile
thor1242's picture
Update Dockerfile
6bba44a verified
FROM node:18-bullseye-slim
# 1. Install utilities and certificates
# We need ca-certificates so wget can talk to https sites
RUN apt-get update && apt-get install -y \
wget \
gnupg \
ca-certificates \
--no-install-recommends
# 2. Add Google's signing key safely
# We download the key, dearmor it, and save it to a specific keyring location
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub \
| gpg --dearmor -o /usr/share/keyrings/google-chrome-keyring.gpg
# 3. Add the Google Repository referencing the key
RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome-keyring.gpg] http://dl.google.com/linux/chrome/deb/ stable main" \
> /etc/apt/sources.list.d/google-chrome.list
# 4. Install System Dependencies (FFmpeg, Xvfb, Chrome, Fonts)
RUN apt-get update && apt-get install -y \
ffmpeg \
xvfb \
google-chrome-stable \
fonts-ipafont-gothic \
fonts-wqy-zenhei \
fonts-thai-tlwg \
fonts-kacst \
fonts-freefont-ttf \
libxss1 \
procps \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy package.json and install node dependencies
# Skip chromium download since we installed it manually
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/google-chrome
COPY package.json ./
RUN npm install
# Copy the rest of the files
COPY . .
# Set permissions
RUN chmod +x start.sh
# Start command
CMD ["./start.sh"]