Update Dockerfile to install Python 3.12 venv and bootstrap pip

- Replaced python3-pip with python3.12-venv in the installation process.
- Added commands to ensure pip is upgraded and installed after setting Python 3.12 as the default.
- Streamlined the installation of PyTorch by removing redundant pip upgrade command.
This commit is contained in:
Jamie Pine
2026-02-03 04:11:27 -08:00
parent 793e392e56
commit 43241b85cf
+6 -5
View File
@@ -15,15 +15,17 @@ RUN apt-get update && apt-get install -y \
&& apt-get update && apt-get install -y \
python3.12 \
python3.12-dev \
python3-pip \
python3.12-venv \
ffmpeg \
curl \
tzdata \
&& rm -rf /var/lib/apt/lists/*
# Set Python 3.12 as default
# Set Python 3.12 as default and bootstrap pip
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1 && \
update-alternatives --install /usr/bin/python python /usr/bin/python3.12 1
update-alternatives --install /usr/bin/python python /usr/bin/python3.12 1 && \
python3.12 -m ensurepip --upgrade && \
python3.12 -m pip install --upgrade pip
# Copy backend
COPY backend/ /app/backend/
@@ -33,8 +35,7 @@ COPY providers/ /app/providers/
COPY web/dist/ /app/web/dist/
# Install PyTorch with CUDA support first
RUN python -m pip install --upgrade pip && \
pip install --no-cache-dir \
RUN pip install --no-cache-dir \
torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
# Install remaining dependencies