Spaces:
Sleeping
Sleeping
File size: 1,106 Bytes
de7fe63 83491c8 de7fe63 c046e3e de7fe63 83491c8 c046e3e 83491c8 cbda74d de7fe63 59612fb de7fe63 59612fb f4c46b4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | # ===== Hugging Face Spaces: Playwright + Chromium (stable) =====
FROM python:3.11-slim
# System deps cho Chromium
RUN apt-get update && apt-get install -y \
wget gnupg unzip curl git \
fonts-liberation libnss3 libxkbcommon0 libatk-bridge2.0-0 \
libxcomposite1 libxrandr2 libxdamage1 libxext6 libdrm2 libgbm1 \
libasound2 libpango-1.0-0 libpangocairo-1.0-0 libgtk-3-0 \
libxshmfence1 libglib2.0-0 libxml2 libxslt1.1 libffi-dev libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Chọn nơi cài browsers PERSISTENT trong image (không dùng /root/.cache)
ENV PLAYWRIGHT_BROWSERS_PATH=/usr/local/share/pw-browsers
# Chú ý: lúc build ta cần tải browsers, nên KHÔNG set SKIP=1 ở đây
WORKDIR /app
COPY . .
# Python deps + Playwright + tải Chromium NGAY TRONG BUILD
RUN pip install --no-cache-dir -r requirements.txt \
&& pip install --no-cache-dir playwright \
&& python -m playwright install --with-deps chromium \
&& chmod -R a+rX /usr/local/share/pw-browsers
# Khi runtime, KHÔNG tải lại browsers
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
CMD ["python", "app.py"]
|