File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -54,11 +54,21 @@ RUN useradd -m -u 1000 heartmula && \
5454# Copy backend requirements first for better caching
5555COPY --chown=heartmula:heartmula backend/requirements.txt /app/backend/
5656
57- # Install Python dependencies
58- RUN pip3 install --no-cache-dir --upgrade pip && \
59- pip3 install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 && \
60- pip3 install --no-cache-dir -r /app/backend/requirements.txt && \
61- pip3 install --no-cache-dir bitsandbytes accelerate
57+ # Install Python dependencies in separate layers for smaller Docker Hub uploads
58+ # Layer 1: pip upgrade
59+ RUN pip3 install --no-cache-dir --upgrade pip
60+
61+ # Layer 2: PyTorch (largest dependency ~800MB)
62+ RUN pip3 install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cu121
63+
64+ # Layer 3: torchvision and torchaudio
65+ RUN pip3 install --no-cache-dir torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
66+
67+ # Layer 4: Other requirements
68+ RUN pip3 install --no-cache-dir -r /app/backend/requirements.txt
69+
70+ # Layer 5: bitsandbytes and accelerate
71+ RUN pip3 install --no-cache-dir bitsandbytes accelerate
6272
6373# Copy backend code
6474COPY --chown=heartmula:heartmula backend/ /app/backend/
You can’t perform that action at this time.
0 commit comments