|
| 1 | +FROM ubuntu:22.04 |
| 2 | +SHELL ["/bin/bash", "-c"] |
| 3 | + |
| 4 | +LABEL maintainer="Hugging Face" |
| 5 | + |
| 6 | +ENV DEBIAN_FRONTEND=noninteractive |
| 7 | + |
| 8 | +WORKDIR /app |
| 9 | + |
| 10 | +# Install required dependencies |
| 11 | +RUN apt-get update && \ |
| 12 | + apt-get install software-properties-common -y && \ |
| 13 | + add-apt-repository ppa:deadsnakes/ppa && \ |
| 14 | + apt-get -y upgrade --only-upgrade systemd openssl cryptsetup && \ |
| 15 | + apt-get install -y \ |
| 16 | + build-essential \ |
| 17 | + bzip2 \ |
| 18 | + curl \ |
| 19 | + git \ |
| 20 | + git-lfs \ |
| 21 | + tar \ |
| 22 | + gcc \ |
| 23 | + g++ \ |
| 24 | + cmake \ |
| 25 | + libprotobuf-dev \ |
| 26 | + protobuf-compiler \ |
| 27 | + python3.11 \ |
| 28 | + python3.11-dev \ |
| 29 | + libsndfile1-dev \ |
| 30 | + ffmpeg && \ |
| 31 | + rm -rf /var/lib/apt/lists/* |
| 32 | + |
| 33 | +# Set Python 3.11 as the default python version |
| 34 | +RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 && \ |
| 35 | + ln -sf /usr/bin/python3.11 /usr/bin/python |
| 36 | + |
| 37 | +# Install pip from source |
| 38 | +RUN curl -O https://bootstrap.pypa.io/get-pip.py && \ |
| 39 | + python get-pip.py && \ |
| 40 | + rm get-pip.py |
| 41 | + |
| 42 | +# Hugging Face Inference Toolkit |
| 43 | +ARG HF_INFERENCE_TOOLKIT_VERSION=bump-dependencies |
| 44 | +ARG HF_INFERENCE_TOOLKIT_URL=git+https://github.com/huggingface/huggingface-inference-toolkit.git@${HF_INFERENCE_TOOLKIT_VERSION} |
| 45 | +RUN pip install --upgrade "${HF_INFERENCE_TOOLKIT_URL}#egg=huggingface-inference-toolkit[torch,diffusers,st,google]" --no-cache-dir |
| 46 | + |
| 47 | +ENV HF_HUB_ENABLE_HF_TRANSFER="1" |
| 48 | + |
| 49 | +# Install Google CLI single command |
| 50 | +RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" \ |
| 51 | + | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \ |
| 52 | + curl https://packages.cloud.google.com/apt/doc/apt-key.gpg \ |
| 53 | + | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && \ |
| 54 | + apt-get update -y && \ |
| 55 | + apt-get install google-cloud-sdk -y && \ |
| 56 | + apt-get clean autoremove --yes && \ |
| 57 | + rm -rf /var/lib/{apt,dpkg,cache,log} |
| 58 | + |
| 59 | +# Copy entrypoint and change permissions |
| 60 | +COPY --chmod=0755 containers/pytorch/inference/cpu/2.3.1/transformers/4.46.0/py311/entrypoint.sh entrypoint.sh |
| 61 | +ENTRYPOINT ["bash", "-c", "./entrypoint.sh"] |
| 62 | + |
0 commit comments