IOPaint / Dockerfile
tom12112's picture
Upload Dockerfile
007c288 verified
raw
history blame
991 Bytes
FROM python:3.10-slim
WORKDIR /app
COPY . .
# 安装系统依赖(OpenCV 等需要)
RUN apt-get update && apt-get install -y --no-install-recommends \
software-properties-common \
libsm6 libxext6 ffmpeg libfontconfig1 libxrender1 libgl1-mesa-glx \
curl gcc build-essential
# 创建模型和缓存目录
RUN mkdir -p /app/models && \
chmod 777 /app/models && \
mkdir -p /tmp/iopaint/models && \
chmod 777 /tmp/iopaint/models
# 安装 PyTorch CPU 版和依赖
RUN pip install --no-cache-dir torch==2.0.1 torchvision==0.15.2 -f https://download.pytorch.org/whl/cpu/torch_stable.html
RUN pip install -r requirements.txt
RUN pip install -e .
# 设置环境变量
ENV IOPAINT_HOST=0.0.0.0
ENV IOPAINT_PORT=7860
ENV IOPAINT_MODEL=lama
ENV IOPAINT_LOW_MEM=true
ENV IOPAINT_DEVICE=cpu
ENV PYTHONUNBUFFERED=1
ENV IOPAINT_MODEL_DIR=/app/models
ENV HF_ENDPOINT=https://hf-mirror.com
EXPOSE 7860
# 使用我们的API服务脚本
CMD ["python", "-m", "iopaint.api_only"]