58 lines
1.2 KiB
Docker
58 lines
1.2 KiB
Docker
|
# Use the official Python 3.12.7 Slim image as the base
|
||
|
FROM python:3.12.7-slim-bullseye
|
||
|
|
||
|
# Set the working directory
|
||
|
WORKDIR /app
|
||
|
|
||
|
# Install system dependencies needed for Playwright and its browsers
|
||
|
RUN apt-get update && apt-get install -y \
|
||
|
bash \
|
||
|
build-essential \
|
||
|
libffi-dev \
|
||
|
git \
|
||
|
curl \
|
||
|
ca-certificates \
|
||
|
wget \
|
||
|
gnupg \
|
||
|
libnss3 \
|
||
|
libatk-bridge2.0-0 \
|
||
|
libx11-xcb1 \
|
||
|
libxcomposite1 \
|
||
|
libxcursor1 \
|
||
|
libxdamage1 \
|
||
|
libxi6 \
|
||
|
libxtst6 \
|
||
|
libappindicator3-1 \
|
||
|
libxrandr2 \
|
||
|
xdg-utils \
|
||
|
libgbm1 \
|
||
|
libpango-1.0-0 \
|
||
|
libasound2 \
|
||
|
libpangocairo-1.0-0 \
|
||
|
libxshmfence1 \
|
||
|
libx11-6 \
|
||
|
libatk1.0-0 \
|
||
|
libgtk-3-0 \
|
||
|
libdrm2 \
|
||
|
&& rm -rf /var/lib/apt/lists/*
|
||
|
|
||
|
# Install Playwright and required Python dependencies
|
||
|
RUN pip install --upgrade pip && \
|
||
|
pip install \
|
||
|
playwright \
|
||
|
beautifulsoup4 \
|
||
|
feedgen \
|
||
|
pytz
|
||
|
|
||
|
# Install Playwright browser binaries
|
||
|
RUN playwright install
|
||
|
|
||
|
# Copy the Python script to the container
|
||
|
COPY main.py .
|
||
|
|
||
|
# Set the environment variable to ensure Playwright works in the container
|
||
|
ENV PLAYWRIGHT_BROWSERS_PATH=/root/.cache/ms-playwright
|
||
|
|
||
|
# Command to run the Python script
|
||
|
CMD ["python", "main.py"]
|