Move pytorch install above cache bust to prevent reinstalling and reuploading it

This commit is contained in:
Jaret Burkett
2025-03-21 06:43:09 -06:00
parent e3373671b9
commit 6c5eb0cf87

View File

@@ -37,6 +37,13 @@ RUN curl -sL https://deb.nodesource.com/setup_23.x -o nodesource_setup.sh && \
WORKDIR /app
# Set aliases for python and pip
RUN echo 'alias python=python3' >> /etc/bash.bashrc && \
echo 'alias pip=pip3' >> /etc/bash.bashrc
# install pytorch before cache bust to avoid redownloading pytorch
RUN pip install --no-cache-dir torch==2.6.0 torchvision==0.21.0 --index-url https://download.pytorch.org/whl/cu126
# Fix cache busting by moving CACHEBUST to right before git clone
ARG CACHEBUST=1234
RUN echo "Cache bust: ${CACHEBUST}" && \
@@ -46,13 +53,8 @@ RUN echo "Cache bust: ${CACHEBUST}" && \
WORKDIR /app/ai-toolkit
# Set aliases for python and pip
RUN echo 'alias python=python3' >> /etc/bash.bashrc && \
echo 'alias pip=pip3' >> /etc/bash.bashrc
# Install Python dependencies
RUN pip install --no-cache-dir torch==2.6.0 torchvision==0.21.0 --index-url https://download.pytorch.org/whl/cu126 && \
pip install --no-cache-dir -r requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Build UI
WORKDIR /app/ai-toolkit/ui