Spaces:
Running
Running
File size: 1,700 Bytes
d649e09 | 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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | FROM python:3.10-slim
# โโ HuggingFace ูุญุชุงุฌ user ุจู UID=1000
RUN useradd -m -u 1000 user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONUNBUFFERED=1 \
PLAYWRIGHT_BROWSERS_PATH=/home/user/.cache/ms-playwright
WORKDIR /home/user/app
# โโ System libs (ููุณ ุงูุฃุตูู)
RUN apt-get update && apt-get install -y \
wget gnupg ca-certificates curl \
libnss3 libnspr4 \
libatk1.0-0 libatk-bridge2.0-0 \
libcups2 libdrm2 libxkbcommon0 \
libxcomposite1 libxdamage1 libxext6 \
libxfixes3 libxrandr2 libgbm1 \
libpango-1.0-0 libcairo2 libasound2 \
&& rm -rf /var/lib/apt/lists/*
# โโ Install Python packages
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# โโ Install Google Chrome (ุนุดุงู channel="chrome" ูุดุชุบู)
RUN mkdir -p /etc/apt/keyrings \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub \
| gpg --dearmor -o /etc/apt/keyrings/google-chrome.gpg \
&& echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/google-chrome.gpg] \
http://dl.google.com/linux/chrome/deb/ stable main" \
> /etc/apt/sources.list.d/google-chrome.list \
&& apt-get update && apt-get install -y google-chrome-stable \
&& rm -rf /var/lib/apt/lists/*
# โโ Install Playwright Chromium (fallback)
RUN playwright install chromium
# โโ Copy project files
COPY --chown=user . .
USER user
# โโ HuggingFace port = 7860
EXPOSE 7860
HEALTHCHECK --interval=30s --timeout=15s --start-period=120s --retries=3 \
CMD curl -f http://localhost:7860/health || exit 1
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|