Skip to content

Commit 1f0eee3

Browse files
committed
Add 'uv' usage to Dockerfile to speed up builds.
1 parent f8996a2 commit 1f0eee3

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

ML-Frameworks/pytorch-aarch64/Dockerfile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,24 +39,27 @@ WORKDIR /home/$DOCKER_USER
3939
RUN python -m venv /home/$DOCKER_USER/.venv
4040
ENV PATH="/home/$DOCKER_USER/.venv/bin:${PATH}"
4141

42+
# Install uv for quicker package installations
43+
RUN pip install uv
44+
4245
# Update to newer pip/setuptools/wheel (setuptools >= 70.0.0 due to CVE-2024-6345
4346
# and CVE-2025-47273, wheel >= 0.38.0 due to CVE-2022-40898) and delete old system
4447
# version (we essentially use apt:python3-pip to bootstrap pip)
45-
RUN pip install --upgrade pip~=25.2 setuptools~=78.1.1 wheel~=0.45.1
48+
RUN uv pip install --upgrade pip~=25.2 setuptools~=78.1.1 wheel~=0.45.1
4649

4750
# Install non-torch requirements
4851
COPY --chown=$DOCKER_USER:$DOCKER_USER requirements.txt .
49-
RUN pip install -r requirements.txt
52+
RUN uv pip install -r requirements.txt
5053

5154
# Bring wheels into image
5255
RUN test -n "${TORCH_WHEEL}" && test -n "${TORCH_AO_WHEEL}"
5356
COPY --chown=$DOCKER_USER:$DOCKER_USER ${TORCH_WHEEL} /home/$DOCKER_USER/
5457
COPY --chown=$DOCKER_USER:$DOCKER_USER ${TORCH_AO_WHEEL} /home/$DOCKER_USER/
5558

5659
# Install wheels
57-
RUN set -eux && pip install --no-deps "$(basename "$TORCH_WHEEL")" && rm "$(basename "$TORCH_WHEEL")"
58-
RUN set -eux && pip install --no-deps "$(basename "$TORCH_AO_WHEEL")" && rm "$(basename "$TORCH_AO_WHEEL")"
59-
RUN pip install --pre torchvision==0.25.0.dev20260130 --index-url https://download.pytorch.org/whl/nightly/cpu --no-deps
60+
RUN set -eux && uv pip install --no-deps "$(basename "$TORCH_WHEEL")" && rm "$(basename "$TORCH_WHEEL")"
61+
RUN set -eux && uv pip install --no-deps "$(basename "$TORCH_AO_WHEEL")" && rm "$(basename "$TORCH_AO_WHEEL")"
62+
RUN uv pip install --pre torchvision==0.25.0.dev20260130 --index-url https://download.pytorch.org/whl/nightly/cpu --no-deps
6063

6164
# Copy examples/tests into image
6265
COPY --chown=$DOCKER_USER:$DOCKER_USER examples/ /home/$DOCKER_USER/
@@ -74,7 +77,6 @@ ENV DOCKER_USER=${USERNAME}
7477
# Runtime OS bits + UI
7578
RUN set -eux && \
7679
apt-get update && \
77-
apt-get install -y --no-install-recommends && \
7880
rm -rf /var/lib/apt/lists/* && \
7981
if ! id "$DOCKER_USER" >/dev/null 2>&1; then useradd --create-home -s /bin/bash "$DOCKER_USER"; fi && \
8082
echo '[ -n "$TERM" -a -r "$HOME/welcome.txt" ] && cat "$HOME/welcome.txt"' >> /etc/bash.bashrc && \

0 commit comments

Comments
 (0)