Spaces:
Runtime error
Runtime error
# # this was going down a rabbit-hole | |
# # particularly with Apple M1 & aarch64 & QEMU | |
# FROM alpine:latest | |
# https://github.com/pytorch/serve | |
#FROM pytorch/pytorch | |
# pinned to 2.3.1, | |
# also see 'assets/bootstrap' | |
FROM pytorch/pytorch:2.3.1-cuda11.8-cudnn8-runtime | |
RUN apt update && apt-get clean | |
RUN set -ex && \ | |
apt install -y sudo && \ | |
apt-get clean | |
COPY --chmod=0440 assets/linux/sudoers-sleepbotzz /etc/sudoers.d/sleepbotzz | |
# User constraints | |
# https://huggingface.co/docs/hub/spaces-sdks-docker#permissions | |
RUN useradd -m -u 1000 -s /bin/bash sleepbotzz | |
# secrets | |
# https://huggingface.co/docs/hub/spaces-sdks-docker | |
# https://docs.docker.com/build/building/secrets/ | |
# https://docs.docker.com/reference/cli/docker/buildx/build/#secret | |
# must be provided in `docker buildx` -- "ERROR: secret BUILD_USER_PASSWORD: not found" | |
# precedent = ARG, secret | |
# password | |
# https://askubuntu.com/questions/752500/how-do-i-encrypt-a-new-users-password-using-the-useradd-command | |
# received as clear text from HF secrets | |
# encrypted with $6 (SHA-512) | |
# direct use of `python` is to avoid escaping the '$'s | |
ARG BUILD_USER_PASSWORD | |
RUN --mount=type=secret,id=BUILD_USER_PASSWORD,mode=0444,required=true \ | |
export BUILD_USER_PASSWORD="${BUILD_USER_PASSWORD:-$(cat /run/secrets/BUILD_USER_PASSWORD)}" ; \ | |
usermod --password \ | |
$(python -c "import crypt; import os; print(crypt.crypt(os.getenv('BUILD_USER_PASSWORD'), \"\$6\$$(</dev/urandom tr -dc 'a-zA-Z0-9' | head -c 32)\$\"))") \ | |
sleepbotzz | |
USER sleepbotzz | |
ENV \ | |
HOME=/home/sleepbotzz \ | |
PATH=/home/sleepbotzz/.local/bin:$PATH | |
WORKDIR $HOME/app | |
COPY --chown=sleepbotzz assets/bootstrap assets/bootstrap | |
# already has: bash python3 | |
RUN set -ex && \ | |
sudo apt install -y \ | |
vim git curl && \ | |
sudo apt-get clean | |
# already has: conda | |
#RUN curl -o '/tmp/Anaconda3-2024.02-1-Linux-x86_64.sh' 'https://repo.anaconda.com/archive/Anaconda3-2024.02-1-Linux-x86_64.sh' | |
#RUN test "$(sha256sum /tmp/Anaconda3-2024.02-1-Linux-x86_64.sh | cut -d ' ' -f 1)" = \ | |
# "c536ddb7b4ba738bddbd4e581b29308cb332fa12ae3fa2cd66814bd735dff231" | |
# | |
#RUN bash /tmp/Anaconda3-2024.02-1-Linux-x86_64.sh -f -b -p /usr/local/anaconda3 | |
RUN conda init | |
RUN conda config --set verbosity 2 --env | |
RUN test "$(conda list pytorch | grep '^pytorch ' | awk -F ' ' '{ printf "%s", $2 }')" = \ | |
"2.3.1" | |
RUN conda env create -f ./assets/bootstrap/anaconda.environment.yml | |
# | |
# !!! DO NOT ADD NEW LINES ABOVE THIS POINT !!! | |
# | |
COPY --chown=sleepbotzz assets assets | |
CMD [ "bash" ] | |
ENTRYPOINT [ "/home/sleepbotzz/app/assets/script/entrypoint.sh" ] | |