Commit 256977d0 authored by zhengyaoqiu's avatar zhengyaoqiu

优化

parent 5cdbaddd
*.pth
*.pt
*.png
*.jpg
venv
\ No newline at end of file
FROM python:3.13-slim AS dependencies
WORKDIR /app
# 安装系统依赖(CLIP需要)
RUN apt-get update && apt-get install -y \
git \
&& rm -rf /var/lib/apt/lists/*
# 设置环境变量
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
# 先安装基础依赖
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip
# 安装 CLIP
RUN pip install --no-cache-dir git+https://github.com/openai/CLIP.git
# 安装其他依赖
RUN pip install --no-cache-dir -r requirements.txt
# 第二阶段:运行时环境
FROM python:3.13-slim AS runtime
WORKDIR /app
# 设置环境变量
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
# 从第一阶段复制已安装的包
COPY --from=dependencies /usr/local/lib/python3.13/site-packages /usr/local/lib/python3.13/site-packages
COPY --from=dependencies /usr/local/bin /usr/local/bin
# 复制应用代码(放在最后,避免代码变更影响依赖缓存)
COPY . .
EXPOSE 5000
CMD ["python", "run.py"]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment