Skip to content

Commit 18ae9a0

Browse files
committed
Fix Dockerfile to use ppa:fkrull/deadsnakes and Python 3.11
- Python 3.11 was being installed, but Python 3.10 was used instead; both via `python` and when installing with `pip` - Fix `pip` installation to use recommended installation path as per https://pip.pypa.io/en/stable/installation/ - Remove `vertex` build stage since there's already a dedicated repository for the Google Cloud Containers, including the Vertex AI compatible ones, i.e. https://github.com/huggingface/Google-Cloud-Containers
1 parent e5af3f9 commit 18ae9a0

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

dockerfiles/pytorch/Dockerfile

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ARG BASE_IMAGE=nvidia/cuda:12.1.0-devel-ubuntu22.04
22

3-
FROM $BASE_IMAGE as base
3+
FROM $BASE_IMAGE as base
44
SHELL ["/bin/bash", "-c"]
55

66
LABEL maintainer="Hugging Face"
@@ -11,7 +11,7 @@ WORKDIR /app
1111

1212
RUN apt-get update && \
1313
apt-get install software-properties-common -y && \
14-
add-apt-repository ppa:deadsnakes/ppa && \
14+
add-apt-repository ppa:fkrull/deadsnakes && \
1515
apt-get -y upgrade --only-upgrade systemd openssl cryptsetup && \
1616
apt-get install -y \
1717
build-essential \
@@ -25,9 +25,8 @@ RUN apt-get update && \
2525
cmake \
2626
libprotobuf-dev \
2727
protobuf-compiler \
28-
python3-dev \
29-
python3-pip \
3028
python3.11 \
29+
python3.11-dev \
3130
libsndfile1-dev \
3231
ffmpeg \
3332
&& apt-get clean autoremove --yes \
@@ -36,6 +35,15 @@ RUN apt-get update && \
3635
# Copying only necessary files as filtered by .dockerignore
3736
COPY . .
3837

38+
# Set Python 3.11 as the default python version
39+
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 && \
40+
ln -sf /usr/bin/python3.11 /usr/bin/python
41+
42+
# Install pip from source
43+
RUN curl -O https://bootstrap.pypa.io/get-pip.py && \
44+
python get-pip.py && \
45+
rm get-pip.py
46+
3947
# install wheel and setuptools
4048
RUN pip install --no-cache-dir --upgrade pip ".[torch,st,diffusers]"
4149

@@ -44,11 +52,6 @@ COPY src/huggingface_inference_toolkit huggingface_inference_toolkit
4452
COPY src/huggingface_inference_toolkit/webservice_starlette.py webservice_starlette.py
4553

4654
# copy entrypoint and change permissions
47-
COPY --chmod=0755 scripts/entrypoint.sh entrypoint.sh
55+
COPY --chmod=0755 scripts/entrypoint.sh entrypoint.sh
4856

4957
ENTRYPOINT ["bash", "-c", "./entrypoint.sh"]
50-
51-
FROM base AS vertex
52-
53-
# Install `google` extra for Vertex AI compatibility
54-
RUN pip install --no-cache-dir --upgrade ".[google]"

0 commit comments

Comments
 (0)