xima-api / Dockerfile
bodyfree's picture
Create Dockerfile
daeedba verified
Raw
History Blame Contribute Delete
643 Bytes
# 使用官方轻量级 Python 镜像
FROM python:3.10-slim
# 设置工作目录
WORKDIR /code
# 安装系统依赖(如果 Pillow 处理某些特殊格式需要)
RUN apt-get update && apt-get install -y \
libmagic1 \
&& rm -rf /var/lib/apt/lists/*
# 先复制依赖文件并安装,利用 Docker 缓存
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 复制项目代码
COPY . .
# 设置权限(Hugging Face 要求)
RUN chmod -R 777 /code
# 暴露端口(Hugging Face 强制要求端口为 7860)
EXPOSE 7860
# 启动命令
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]