Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐸 Add NVIDIA CUDA #107

Merged
merged 10 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 36 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ ENV CONTAINER_USER="analyticalplatform" \
DOTNET_SDK_VERSION="8.0.107-0ubuntu1~24.04.1" \
OLLAMA_VERSION="0.2.1" \
OLLAMA_SHA256="8a29a80403f67abe0f5b3737767b2a21732409e8e4429098af75474484e43c18" \
PATH="/opt/conda/bin:${HOME}/.local/bin:${PATH}"
CUDA_VERSION="12.5.1" \
NVIDIA_DISABLE_REQUIRE="true" \
NVIDIA_CUDA_CUDART_VERSION="12.5.82-1" \
NVIDIA_CUDA_COMPAT_VERSION="555.42.06-1" \
NVIDIA_VISIBLE_DEVICES="all" \
NVIDIA_DRIVER_CAPABILITIES="compute,utility" \
LD_LIBRARY_PATH="/usr/local/nvidia/lib:/usr/local/nvidia/lib64" \
PATH="/usr/local/nvidia/bin:/usr/local/cuda/bin:/opt/conda/bin:${HOME}/.local/bin:${PATH}"

SHELL ["/bin/bash", "-e", "-u", "-o", "pipefail", "-c"]

Expand Down Expand Up @@ -49,6 +56,7 @@ apt-get install --yes \
"ca-certificates=20240203" \
"curl=8.5.0-2ubuntu10.1" \
"git=1:2.43.0-1ubuntu7.1" \
"gnupg2=2.4.4-2ubuntu17" \
"gpg=2.4.4-2ubuntu17" \
"jq=1.7.1-3build1" \
"mandoc=1.14.6-1" \
Expand Down Expand Up @@ -97,7 +105,7 @@ apt-get install --yes "code=${VISUAL_STUDIO_CODE_VERSION}"

apt-get clean --yes

rm --force --recursive packages.microsoft.gpg /var/lib/apt/lists/*
rm --force --recursive microsoft.asc packages.microsoft.gpg /var/lib/apt/lists/*
EOF

# AWS CLI
Expand Down Expand Up @@ -181,6 +189,32 @@ install --owner=root --group=root --mode=775 ollama /usr/local/bin/ollama
rm --force ollama
EOF

# NVIDIA CUDA
RUN <<EOF
curl --location --fail-with-body \
"https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/3bf863cc.pub" \
--output "3bf863cc.pub"

cat 3bf863cc.pub | gpg --dearmor --output nvidia.gpg

install -D --owner root --group root --mode 644 nvidia.gpg /etc/apt/keyrings/nvidia.gpg

echo "deb [signed-by=/etc/apt/keyrings/nvidia.gpg] https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64 /" > /etc/apt/sources.list.d/cuda.list

apt-get update --yes

apt-get install --yes \
"cuda-cudart-12-5=${NVIDIA_CUDA_CUDART_VERSION}" \
"cuda-compat-12-5=${NVIDIA_CUDA_COMPAT_VERSION}"

echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf
echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf

apt-get clean --yes

rm --force --recursive 3bf863cc.pub /var/lib/apt/lists/*
EOF

USER ${CONTAINER_USER}
WORKDIR /home/${CONTAINER_USER}
EXPOSE 8080
Expand Down
5 changes: 2 additions & 3 deletions src/etc/bash.bashrc.snippet
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# This is a first run notice for Visual Studio Code
if [[ -t 1 ]] && [[ "${TERM_PROGRAM}" = "vscode" ]] && [[ ! -f "/home/analyticalplatform/.vscode/first-run-notice-already-displayed" ]]; then
if [[ -t 1 ]] && [[ "${TERM_PROGRAM}" = "vscode" ]] && [[ ! -f "/opt/visual-studio-code/first-run-notice-already-displayed" ]]; then
cat /opt/visual-studio-code/first-run-notice.txt
# Mark first run notice as displayed after 10s to avoid problems with fast terminal refreshes hiding it
mkdir --parents "/home/analyticalplatform/.vscode"
((sleep 10s; touch "/home/analyticalplatform/.vscode/first-run-notice-already-displayed") &)
((sleep 10s; touch "/opt/visual-studio-code/first-run-notice-already-displayed") &)
fi
4 changes: 4 additions & 0 deletions test/container-structure-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,7 @@ fileExistenceTests:
- name: "/opt/visual-studio-code/.profile"
path: "/opt/visual-studio-code/.profile"
shouldExist: true

- name: "/usr/local/cuda/lib64/libcudart.so.12"
path: "/usr/local/cuda/lib64/libcudart.so.12"
shouldExist: true