tienhiep-api / Dockerfile
Cong123779
deploy: update backend production to new Space
d9bfc2d
Raw
History Blame Contribute Delete
785 Bytes
# Hugging Face Space Dockerfile
# Port PHẢI là 7860 theo yêu cầu của HuggingFace
FROM python:3.10-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Tạo user theo yêu cầu HuggingFace (UID 1000)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONUNBUFFERED=1
WORKDIR $HOME/app
# Copy và cài requirements
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy toàn bộ code (không có .db files - dùng .dockerignore)
COPY --chown=user . .
# Expose port 7860 bắt buộc
EXPOSE 7860
# Chạy qua script start_hf.sh để tải DB và cấu hình log
CMD ["/bin/bash", "start_hf.sh"]