mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-11-10 09:03:02 +08:00
Reduce CUDA images size (#2724)
This commit is contained in:
parent
a4cc39ec22
commit
94b6f25ba6
5 changed files with 20 additions and 21 deletions
|
@ -12,3 +12,5 @@ npm-debug.log
|
||||||
/assets/node_modules/
|
/assets/node_modules/
|
||||||
/tmp/
|
/tmp/
|
||||||
/livebook
|
/livebook
|
||||||
|
# Ignore app release files, including build artifacts
|
||||||
|
/rel/app
|
||||||
|
|
|
@ -51,6 +51,8 @@ RUN mix do compile, release livebook
|
||||||
# Consequently the release doesn't include ERTS as we have it anyway.
|
# Consequently the release doesn't include ERTS as we have it anyway.
|
||||||
FROM ${BASE_IMAGE}
|
FROM ${BASE_IMAGE}
|
||||||
|
|
||||||
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
RUN apt-get update && apt-get upgrade -y && \
|
RUN apt-get update && apt-get upgrade -y && \
|
||||||
apt-get install --no-install-recommends -y \
|
apt-get install --no-install-recommends -y \
|
||||||
# Runtime dependencies
|
# Runtime dependencies
|
||||||
|
|
|
@ -2,25 +2,20 @@ ARG ELIXIR_VERSION
|
||||||
ARG ERLANG_VERSION
|
ARG ERLANG_VERSION
|
||||||
ARG UBUNTU_VERSION
|
ARG UBUNTU_VERSION
|
||||||
|
|
||||||
|
FROM hexpm/elixir:${ELIXIR_VERSION}-erlang-${ERLANG_VERSION}-ubuntu-${UBUNTU_VERSION}
|
||||||
|
|
||||||
ARG CUDA_VERSION
|
ARG CUDA_VERSION
|
||||||
|
|
||||||
FROM hexpm/elixir:${ELIXIR_VERSION}-erlang-${ERLANG_VERSION}-ubuntu-${UBUNTU_VERSION} AS elixir
|
RUN distro="ubuntu$(. /etc/lsb-release; echo "$DISTRIB_RELEASE" | tr -d '.')" && \
|
||||||
|
# Official Docker images use the sbsa packages when targetting arm64.
|
||||||
|
# See https://gitlab.com/nvidia/container-images/cuda/-/blob/85f465ea3343a2d7f7753a0a838701999ed58a01/dist/12.5.1/ubuntu2204/base/Dockerfile#L12
|
||||||
|
arch="$(if [ "$(uname -m)" = "aarch64" ]; then echo "sbsa"; else echo "x86_64"; fi)" && \
|
||||||
|
apt update -q && apt install -y ca-certificates wget && \
|
||||||
|
wget -qO /tmp/cuda-keyring.deb https://developer.download.nvidia.com/compute/cuda/repos/$distro/$arch/cuda-keyring_1.1-1_all.deb && \
|
||||||
|
dpkg -i /tmp/cuda-keyring.deb && apt update -q
|
||||||
|
|
||||||
FROM nvidia/cuda:${CUDA_VERSION}-cudnn8-devel-ubuntu20.04
|
# In order to minimize the image size, we install only a subset of
|
||||||
|
# the CUDA toolkit that is required by Elixir numerical packages
|
||||||
ENV DEBIAN_FRONTEND nonintaeractive
|
# (nvcc and runtime libraries). Note that we do not need to install
|
||||||
ENV LANG=C.UTF-8
|
# the driver, it is already provided by NVIDIA Container Toolkit.
|
||||||
|
RUN apt install -y git cuda-nvcc-${CUDA_VERSION} cuda-libraries-${CUDA_VERSION} libcudnn8
|
||||||
# Erlang runtime dependencies, see https://github.com/hexpm/bob/blob/3b5721dccdfe9d59766f374e7b4fb7fb8a7c720e/priv/scripts/docker/erlang-ubuntu-focal.dockerfile#L41-L45
|
|
||||||
RUN apt-get update && \
|
|
||||||
apt-get -y --no-install-recommends install \
|
|
||||||
libodbc1 \
|
|
||||||
libssl1.1 \
|
|
||||||
libsctp1
|
|
||||||
|
|
||||||
# We copy the top-level directory first to preserve symlinks in /usr/local/bin
|
|
||||||
COPY --from=elixir /usr/local /usr/ELIXIR_LOCAL
|
|
||||||
|
|
||||||
RUN cp -r /usr/ELIXIR_LOCAL/lib/* /usr/local/lib && \
|
|
||||||
cp -r /usr/ELIXIR_LOCAL/bin/* /usr/local/bin && \
|
|
||||||
rm -rf /usr/ELIXIR_LOCAL
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ if [ -z "$livebook_version" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cuda_tag_list=("cuda11.8" "cuda12.1")
|
cuda_tag_list=("cuda11.8" "cuda12.1")
|
||||||
cuda_version_list=("11.8.0" "12.1.0")
|
cuda_version_list=("11-8" "12-1")
|
||||||
|
|
||||||
for idx in "${!cuda_tag_list[@]}"; do
|
for idx in "${!cuda_tag_list[@]}"; do
|
||||||
cuda_tag="${cuda_tag_list[idx]}"
|
cuda_tag="${cuda_tag_list[idx]}"
|
||||||
|
|
2
versions
2
versions
|
@ -3,4 +3,4 @@ otp="27.0"
|
||||||
openssl="1.1.1s"
|
openssl="1.1.1s"
|
||||||
rebar3="3.22.0"
|
rebar3="3.22.0"
|
||||||
debian="bookworm-20240701-slim"
|
debian="bookworm-20240701-slim"
|
||||||
ubuntu="focal-20240530"
|
ubuntu="jammy-20240530"
|
||||||
|
|
Loading…
Reference in a new issue