Spaces:
Sleeping
Sleeping
FROM mcr.microsoft.com/playwright/python:v1.30.0-focal | |
WORKDIR /code | |
# Cài đặt các gói phụ thuộc cho Python, Playwright và Chromium | |
RUN apt-get update && apt-get install -y \ | |
python3-pip \ | |
python3-venv \ | |
ffmpeg \ | |
libsm6 \ | |
libxext6 \ | |
poppler-utils \ | |
libatk1.0-0 \ | |
libatk-bridge2.0-0 \ | |
libcups2 \ | |
libxcomposite1 \ | |
libxdamage1 \ | |
libatspi2.0-0 \ | |
chromium-bsu \ | |
&& apt-get clean \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Cài đặt môi trường ảo và các thư viện Python | |
RUN python3 -m venv /code/venv | |
ENV PATH="/code/venv/bin:$PATH" | |
RUN pip install --no-cache-dir --upgrade pip setuptools wheel | |
RUN pip install playwright | |
RUN playwright install | |
# Sao chép mã nguồn | |
COPY ./requirements.txt /code/requirements.txt | |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt | |
COPY . . | |
# Mở các cổng cần thiết | |
EXPOSE 7860 9222 | |
# Khởi động ứng dụng với Uvicorn | |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |