Download Dockerfile from ManTea/TestAPI: direct link, hf CLI and curl.
- Browser
- Download file 780 Bytes
-
https://huggingface.co/spaces/ManTea/TestAPI/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/ManTea/TestAPI/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/ManTea/TestAPI/resolve/main/Dockerfile
780 Bytes
| # Sử dụng Python image | |
| FROM python:3.11.5-slim-bookworm | |
| # Tạo người dùng mới để chạy ứng dụng | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| # Cập nhật biến môi trường PATH | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| # Thiết lập thư mục làm việc | |
| WORKDIR /app | |
| # Copy file requirements vào container | |
| COPY --chown=user ./requirements.txt /app/requirements.txt | |
| # Cài đặt các package cần thiết | |
| RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt | |
| # Copy toàn bộ mã nguồn vào container | |
| COPY --chown=user . /app | |
| # Sao chép file cred.json vào thư mục chính xác | |
| COPY --chown=user ./cred.json /app/config/cred.json | |
| # Chạy ứng dụng với uvicorn | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |