Spaces:
Paused
Paused
| # Use an official CUDA runtime as a parent image | |
| FROM nvidia/cuda:12.2.0-devel-ubuntu22.04 | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| # Update and install necessary packages | |
| RUN apt update && \ | |
| apt install -y --no-install-recommends \ | |
| curl \ | |
| git \ | |
| git-lfs \ | |
| libatomic1 \ | |
| locales \ | |
| gettext \ | |
| man \ | |
| nano \ | |
| net-tools \ | |
| netcat \ | |
| openssh-client \ | |
| python3 \ | |
| python3-pip \ | |
| python3-venv \ | |
| sudo \ | |
| vim \ | |
| wget \ | |
| zsh \ | |
| zip \ | |
| unzip \ | |
| ffmpeg \ | |
| gettext \ | |
| imagemagick \ | |
| build-essential \ | |
| libssl-dev \ | |
| libffi-dev \ | |
| python3-dev \ | |
| libblas-dev \ | |
| liblapack-dev \ | |
| gfortran \ | |
| libsndfile1 \ | |
| libespeak-ng1 \ | |
| libportaudio2 \ | |
| libportaudiocpp0 \ | |
| portaudio19-dev \ | |
| libsndfile1-dev \ | |
| jq && \ | |
| git lfs install && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # Fix ImageMagick policy | |
| RUN sed -i '/<policy domain="path" rights="none" pattern="@\*"/d' /etc/ImageMagick-6/policy.xml | |
| WORKDIR /home/ | |
| ENV USERNAME=user \ | |
| USER_UID=1000 \ | |
| USER_GID=1000 \ | |
| LANG=C.UTF-8 \ | |
| LC_ALL=C.UTF-8 \ | |
| NVIDIA_VISIBLE_DEVICES=all \ | |
| NVIDIA_DRIVER_CAPABILITIES=all \ | |
| EDITOR=code \ | |
| VISUAL=code \ | |
| GIT_EDITOR="code --wait" \ | |
| OPENVSCODE_SERVER_ROOT=/home/.vscode \ | |
| OPENVSCODE=/home/.vscode/bin/openvscode-server \ | |
| PATH=/home/user/.local/bin:/home/user/.poetry/bin:$PATH | |
| # Downloading the latest VSC Server release and extracting the release archive | |
| # Rename `openvscode-server` cli tool to `code` for convenience | |
| RUN RELEASE_TAG=$(curl -sX GET "https://api.github.com/repos/gitpod-io/openvscode-server/releases/latest" | awk '/tag_name/{print $4;exit}' FS='[""]') && \ | |
| arch=$(uname -m) && \ | |
| if [ "${arch}" = "x86_64" ]; then \ | |
| arch="x64"; \ | |
| elif [ "${arch}" = "aarch64" ]; then \ | |
| arch="arm64"; \ | |
| elif [ "${arch}" = "armv7l" ]; then \ | |
| arch="armhf"; \ | |
| fi && \ | |
| wget https://github.com/gitpod-io/openvscode-server/releases/download/${RELEASE_TAG}/${RELEASE_TAG}-linux-${arch}.tar.gz && \ | |
| tar -xzf ${RELEASE_TAG}-linux-${arch}.tar.gz && \ | |
| mv ${RELEASE_TAG}-linux-${arch} ${OPENVSCODE_SERVER_ROOT} && \ | |
| cp ${OPENVSCODE_SERVER_ROOT}/bin/remote-cli/openvscode-server ${OPENVSCODE_SERVER_ROOT}/bin/remote-cli/code && \ | |
| rm -f ${RELEASE_TAG}-linux-${arch}.tar.gz | |
| # Install latest Firefox | |
| RUN sudo install -d -m 0755 /etc/apt/keyrings && \ | |
| wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | sudo tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null && \ | |
| echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" | sudo tee -a /etc/apt/sources.list.d/mozilla.list > /dev/null && \ | |
| echo 'Package: *\nPin: origin packages.mozilla.org\nPin-Priority: 1000' | sudo tee /etc/apt/preferences.d/mozilla && \ | |
| sudo apt-get update && sudo apt-get install -y firefox | |
| # Download and install latest GeckoDriver | |
| RUN GECKO_LATEST=$(curl -sL https://api.github.com/repos/mozilla/geckodriver/releases/latest | jq -r '.tag_name') && \ | |
| wget https://github.com/mozilla/geckodriver/releases/download/${GECKO_LATEST}/geckodriver-${GECKO_LATEST}-linux64.tar.gz && \ | |
| tar -xvzf geckodriver-${GECKO_LATEST}-linux64.tar.gz && \ | |
| sudo mv geckodriver /usr/local/bin/ && \ | |
| sudo chmod +x /usr/local/bin/geckodriver && \ | |
| rm geckodriver-${GECKO_LATEST}-linux64.tar.gz && \ | |
| geckodriver --version | |
| WORKDIR /home/user/ | |
| # Creating the user and usergroup | |
| RUN groupadd --gid ${USER_GID} ${USERNAME} && \ | |
| useradd --uid ${USER_UID} --gid ${USERNAME} -m -s /bin/bash ${USERNAME} && \ | |
| echo ${USERNAME} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USERNAME} && \ | |
| chmod 0440 /etc/sudoers.d/${USERNAME} | |
| RUN chmod g+rw /home && \ | |
| chown -R ${USERNAME}:${USERNAME} ${OPENVSCODE_SERVER_ROOT} && \ | |
| chown -R ${USERNAME}:${USERNAME} /home/${USERNAME} | |
| USER $USERNAME | |
| # Install oh-my-zsh & Init | |
| RUN yes | sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" | |
| # Install VSCode Extensions | |
| RUN ${OPENVSCODE} --install-extension ms-python.python && \ | |
| ${OPENVSCODE} --install-extension monokai.theme-monokai-pro-vscode | |
| # Install Poetry | |
| RUN curl -sSL https://install.python-poetry.org | python3 - | |
| # Set the entrypoint for the application | |
| ENTRYPOINT ["/bin/sh", "-c", "exec $OPENVSCODE --host 0.0.0.0 --port 7860 --without-connection-token"] |