crew / Dockerfile
arnekm's picture
Update Dockerfile
a40f35b verified
Raw History Blame Contribute Delete
540 Bytes
FROM python:3.11-slim
# HuggingFace Spaces 用 1000 UID
RUN useradd -m -u 1000 user
WORKDIR /app
# Ensure the user owns the working directory
RUN chown user:user /app
# 安裝系統依賴
RUN apt-get update && apt-get install -y \
gcc g++ curl \
&& rm -rf /var/lib/apt/lists/*
# 安裝 Python 依賴
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 複製程式碼
COPY --chown=user:user . .
USER user
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]