Spaces:
Running
Running
File size: 1,166 Bytes
e81dd9a 983ae19 e81dd9a 983ae19 42e4f57 acfdffe 983ae19 e81dd9a 983ae19 42e4f57 e81dd9a |
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 31 32 33 34 35 |
FROM python:3.9-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
gcc \
python3-dev \
curl \
gnupg \
libxml2-dev \
libxslt-dev \
&& curl -sL https://deb.nodesource.com/setup_16.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g playwright \
&& playwright install-deps chromium \
&& playwright install chromium
WORKDIR /app
# Download application files
RUN mkdir -p templates && \
curl -L https://huggingface.co/datasets/qdqd/web-api/resolve/main/api.py -o api.py && \
curl -L https://huggingface.co/datasets/qdqd/web-api/resolve/main/requirements.txt -o requirements.txt && \
curl -L https://huggingface.co/datasets/qdqd/web-api/resolve/main/index.html -o templates/index.html
# Install Python dependencies with fixed versions
RUN pip install --no-cache-dir -r requirements.txt \
&& pip install lxml[html_clean]==4.9.4 lxml_html_clean==3.0.0
# Configure environment
ENV PLAYWRIGHT_BROWSERS_PATH=/home/user/.cache/ms-playwright \
PYTHONUNBUFFERED=1
EXPOSE 7860
CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "7860", "--timeout-keep-alive", "300"] |