fix(photo-ai): persist pip cache to avoid re-downloading torch wheels

This commit is contained in:
dev
2026-10-22 23:19:24 +03:00
parent 816e7b2e38
commit d19611573f
+4 -5
View File
@@ -6,8 +6,7 @@ ARG TORCH_INDEX=https://download.pytorch.org/whl/${TORCH_VARIANT}
WORKDIR /app WORKDIR /app
ENV PIP_NO_CACHE_DIR=1 \ ENV PIP_BUILD_ISOLATION=0 \
PIP_BUILD_ISOLATION=0 \
PYTHONDONTWRITEBYTECODE=1 \ PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \ PYTHONUNBUFFERED=1 \
HF_HOME=/root/.cache/huggingface \ HF_HOME=/root/.cache/huggingface \
@@ -17,14 +16,14 @@ ENV PIP_NO_CACHE_DIR=1 \
RUN apt-get update && apt-get install -y --no-install-recommends libgl1 libglib2.0-0 && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -y --no-install-recommends libgl1 libglib2.0-0 && rm -rf /var/lib/apt/lists/*
RUN --mount=type=cache,target=/root/.cache/pip \ RUN --mount=type=cache,target=/root/.cache/pip,sharing=locked \
pip install --upgrade pip && \ pip install --upgrade pip && \
pip install "typing-extensions==4.12.2" "numpy==2.2.6" pip install "typing-extensions==4.12.2" "numpy==2.2.6"
RUN --mount=type=cache,target=/root/.cache/pip \ RUN --mount=type=cache,target=/root/.cache/pip,sharing=locked \
pip install torch torchvision --index-url ${TORCH_INDEX} pip install torch torchvision --index-url ${TORCH_INDEX}
RUN --mount=type=cache,target=/root/.cache/pip \ RUN --mount=type=cache,target=/root/.cache/pip,sharing=locked \
pip install --upgrade setuptools wheel && \ pip install --upgrade setuptools wheel && \
pip install --no-build-isolation --no-deps basicsr==1.4.2 realesrgan==0.3.0 gfpgan==1.3.8 facexlib==0.3.0 && \ pip install --no-build-isolation --no-deps basicsr==1.4.2 realesrgan==0.3.0 gfpgan==1.3.8 facexlib==0.3.0 && \
pip install "numpy==2.2.6" "opencv-python-headless==5.0.0.93" addict future lmdb Pillow pyyaml \ pip install "numpy==2.2.6" "opencv-python-headless==5.0.0.93" addict future lmdb Pillow pyyaml \