puppeteer api
Build and Push Docker Images / build-and-push (push) Failing after 45s

This commit is contained in:
Bram Kelchtermans
2025-01-28 10:50:05 +01:00
parent 9881e7eb7d
commit cac0101528
3 changed files with 105 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
FROM python:3.9-slim
# Install required system dependencies
RUN apt-get update && apt-get install -y \
wget \
gnupg2 \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /usr/share/keyrings/google-chrome-keyring.gpg \
&& echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome-keyring.gpg] http://dl.google.com/linux/chrome/deb/ stable main" | tee /etc/apt/sources.list.d/google-chrome.list \
&& 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 \
xvfb \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
# Verify Chrome installation
&& google-chrome --version
# Set working directory
WORKDIR /app
# Copy requirements first to leverage Docker cache
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application
COPY . .
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV API_KEY=""
# Create a non-root user and switch to it
RUN useradd -m puppeteer && chown -R puppeteer:puppeteer /app
USER puppeteer
# Expose port
EXPOSE 8000
# Run the application
CMD ["python", "main.py"]