Spaces:
Sleeping
Sleeping
Download Dockerfile from Vietho88/fastapi-app: direct link, hf CLI and curl.
- Browser
- Download file 1.4 kB
-
https://huggingface.co/spaces/Vietho88/fastapi-app/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/Vietho88/fastapi-app/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/Vietho88/fastapi-app/resolve/main/Dockerfile
1.4 kB
| FROM python:3.9-slim | |
| # Cài đặt các dependencies cần thiết | |
| RUN apt-get update && apt-get install -y \ | |
| wget \ | |
| gnupg \ | |
| && apt-get clean && rm -rf /var/lib/apt/lists/* | |
| # Tạo user không phải root | |
| RUN useradd -m -u 1000 user | |
| WORKDIR /app | |
| # Copy requirements.txt | |
| COPY --chown=user ./requirements.txt requirements.txt | |
| # Cài đặt Playwright và các dependencies Python khác | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Cài đặt Chromium và các dependencies của nó | |
| RUN apt-get update && apt-get install -y \ | |
| 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 \ | |
| libasound2 \ | |
| && apt-get clean && rm -rf /var/lib/apt/lists/* | |
| # Cài đặt Chromium cho Playwright | |
| RUN su user -c "playwright install chromium" | |
| # Đặt quyền cho thư mục .cache | |
| RUN mkdir -p /home/user/.cache && chown -R user:user /home/user/.cache | |
| # Copy tất cả files từ thư mục hiện tại vào /app trong container | |
| COPY --chown=user . . | |
| # Chuyển sang user không phải root | |
| USER user | |
| # Command để chạy ứng dụng | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |