Spaces:
Sleeping
Sleeping
FROM mcr.microsoft.com/playwright:v1.49.0-noble | |
WORKDIR /code | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
libglib2.0-0 \ | |
libnss3 \ | |
libnspr4 \ | |
libatk1.0-0 \ | |
libatk-bridge2.0-0 \ | |
libcups2 \ | |
libdrm2 \ | |
libdbus-1-3 \ | |
libxcb1 \ | |
libxkbcommon0 \ | |
libx11-6 \ | |
libxcomposite1 \ | |
libxdamage1 \ | |
libxext6 \ | |
libxfixes3 \ | |
libxrandr2 \ | |
libgbm1 \ | |
libpango-1.0-0 \ | |
libcairo2 \ | |
libatspi2.0-0 \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Cài đặt các gói phụ thuộc cần thiết | |
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 \ | |
&& apt-get clean \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Tạo môi trường ảo | |
RUN python3 -m venv /code/venv | |
ENV PATH="/code/venv/bin:$PATH" | |
# Cập nhật pip trong môi trường ảo | |
RUN pip install --no-cache-dir --upgrade pip setuptools wheel | |
# Cài đặt Playwright và các thư viện | |
RUN pip install playwright | |
RUN playwright install | |
RUN playwright install-deps | |
RUN playwright install chromium | |
# Sao chép mã nguồn | |
COPY ./requirements.txt /code/requirements.txt | |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt | |
RUN playwright install chromium | |
COPY . . | |
# Mở cổng | |
EXPOSE 7860 | |
EXPOSE 9222 | |
# Khởi động ứng dụng | |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |