Skip to content

Commit

Permalink
Upgrade base image to 24.04 and Cuda 12.2
Browse files Browse the repository at this point in the history
Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
  • Loading branch information
angiglesias committed May 5, 2024
1 parent 3551c05 commit feb8ffe
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: redhat-actions/buildah-build@v2
with:
image: ubuntu-toolbox
tags: latest 22.04
tags: latest 24.04
containerfiles: |
./Dockerfile
Expand Down
17 changes: 14 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG RELEASE=22.04
ARG RELEASE=24.04

FROM docker.io/library/ubuntu:${RELEASE}

Expand All @@ -8,7 +8,7 @@ LABEL com.github.containers.toolbox="true" \
version="${RELEASE}" \
usage="This image is meant to be used with the toolbox command" \
summary="Base image for creating Ubuntu toolbox containers" \
maintainer="Debarshi Ray <rishi@fedoraproject.org>"
maintainer="Angel Iglesias <ang.iglesiasg@gmail.com>"

COPY README.md /

Expand All @@ -25,7 +25,8 @@ RUN sed -Ei '/apt-get (update|upgrade)/s/^/#/' /usr/local/sbin/unminimize && \
yes | /usr/local/sbin/unminimize && \
DEBIAN_FRONTEND=noninteractive apt-get -y install \
ubuntu-minimal ubuntu-standard \
libnss-myhostname && \
libnss-myhostname \
flatpak-xdg-utils && \
DEBIAN_FRONTEND=noninteractive apt-get -y install \
--no-install-recommends \
gnome-terminal && \
Expand All @@ -44,4 +45,14 @@ RUN sed -i '/^auth.*pam_unix.so/s/nullok_secure/try_first_pass nullok/' /etc/pam
# Fix empty bind-mount to clear selinuxfs (see #337)
RUN mkdir /usr/share/empty

# Add flatpak-spawn to /usr/bin
RUN ln -s /usr/libexec/flatpak-xdg-utils/flatpak-spawn /usr/bin/

# Having anything in /home prevents toolbox from symlinking /var/home there,
# and 'ubuntu' user with UID 1000 will most likely conflict with host user as well
RUN userdel --remove ubuntu

# Disable APT ESM hook which tries to enable some systemd services on each apt invocation
RUN rm /etc/apt/apt.conf.d/20apt-esm-hook.conf

CMD /bin/bash
42 changes: 36 additions & 6 deletions Dockerfile.cuda
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# BASE image
ARG BASE_IMAGE=ubuntu-toolbox:22.04
ARG BASE_IMAGE=ubuntu-toolbox:24.04

FROM ${BASE_IMAGE}

# CUDA and CUDNN versions
ARG CUDA_PLATFORM=ubuntu2204
ARG CUDA_RELEASE=11-8
ARG CUDA_RELEASE=12-2
ARG CUDNN_BRANCH=8
ARG CUDNN_RELEASE=8.6.0.163-1+cuda11.8
ARG CUDNN_RELEASE=8.9.7.29-1+cuda12.2
ARG BINARIES_DIR=/data/bins
ARG TARGETARCH=amd64
ARG RELEASE=24.04

RUN apt-get update && \
apt-get install -y build-essential openjdk-8-jdk && \
Expand All @@ -27,6 +28,23 @@ RUN apt-get update && \
update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-9 9 && \
update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-8 10; \
fi && \
if [ "${CUDA_RELEASE}" = "12-2" ]; then \
apt-get install -y gcc-12 g++-12 && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 9 && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 10 && \
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 9 && \
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 10 && \
update-alternatives --quiet --remove cpp /usr/bin/cpp && \
update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-13 9 && \
update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-12 10; \
fi && \
# Nsight deps workaround
echo "${CUDA_PLATFORM} :: ${RELEASE}" && \
if [ "${CUDA_PLATFORM}" = "ubuntu2204" ] && [ "${RELEASE}" = "24.04" ]; then \
wget http://security.ubuntu.com/ubuntu/pool/universe/n/ncurses/libtinfo5_6.3-2ubuntu0.1_amd64.deb && \
dpkg -i libtinfo5_6.3-2ubuntu0.1_amd64.deb && \
rm libtinfo5_6.3-2ubuntu0.1_amd64.deb; \
fi && \
apt clean && rm -rd /var/lib/apt/lists/*

# Install CUDA and CUDNN runtime and development
Expand All @@ -36,10 +54,22 @@ RUN wget \
if [ -f ${BINARIES_DIR}/faed14dd.pub ]; then \
apt-key add ${BINARIES_DIR}/faed14dd.pub; \
fi && \
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/${CUDA_PLATFORM}/x86_64/3bf863cc.pub && \
add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/${CUDA_PLATFORM}/x86_64/ /" && \
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb && \
dpkg -i cuda-keyring_1.1-1_all.deb && \
rm cuda-keyring_1.1-1_all.deb && \
apt-get update && apt-get install -y cuda-toolkit-${CUDA_RELEASE} && \
dpkg -i ${BINARIES_DIR}/libcudnn${CUDNN_BRANCH}_${CUDNN_RELEASE}_${TARGETARCH}.deb ${BINARIES_DIR}/libcudnn${CUDNN_BRANCH}-dev_${CUDNN_RELEASE}_${TARGETARCH}.deb && \
if [ -n "${CUDNN_RELEASE}" ]; then \
if [ -f "${BINARIES_DIR}/libcudnn${CUDNN_BRANCH}_${CUDNN_RELEASE}_${TARGETARCH}.deb" ] && \
[ -f "${BINARIES_DIR}/libcudnn${CUDNN_BRANCH}-dev_${CUDNN_RELEASE}_${TARGETARCH}.deb" ]; then \
dpkg -i ${BINARIES_DIR}/libcudnn${CUDNN_BRANCH}_${CUDNN_RELEASE}_${TARGETARCH}.deb \
${BINARIES_DIR}/libcudnn${CUDNN_BRANCH}-dev_${CUDNN_RELEASE}_${TARGETARCH}.deb; \
else \
apt-get install -y libcudnn${CUDNN_BRANCH}=${CUDNN_RELEASE} \
libcudnn${CUDNN_BRANCH}-dev=${CUDNN_RELEASE}; \
fi \
else \
apt-get install -y cudnn${CUDNN_BRANCH}-cuda-${CUDA_RELEASE}; \
fi && \
apt clean && rm -rd /var/lib/apt/lists/*

# Post-install configurations
Expand Down
14 changes: 7 additions & 7 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# BASE image
ARG BASE_IMAGE=ubuntu-toolbox:22.04-cuda11.8
ARG BASE_IMAGE=ubuntu-toolbox:24.04-cuda12.2

FROM ${BASE_IMAGE}

# FFMPEG and OpenCV versions
ARG CUDA_ARCH_BIN=8.6
ARG OPENCV_RELEASE=4.6.0
ARG FFMPEG_RELEASE=5.0.2
ARG VIDEOSDK_RELEASE=11.1.5.2
ARG OPENCV_RELEASE=4.9.0
ARG FFMPEG_RELEASE=7.0
ARG VIDEOSDK_RELEASE=12.2.72.0

WORKDIR /opt/workspace

Expand All @@ -30,10 +30,10 @@ RUN apt-get update && \
RUN wget https://ffmpeg.org/releases/ffmpeg-${FFMPEG_RELEASE}.tar.gz -O ffmpeg.tar.gz && \
tar -zxvf ffmpeg.tar.gz && cd ffmpeg-${FFMPEG_RELEASE} && \
. /etc/profile.d/cuda.sh && \
./configure --enable-nonfree --enable-cuda-nvcc --enable-nvdec --enable-nvenc --enable-libnpp \
--extra-cflags="-I/usr/local/cuda/include" --extra-ldflags="-L/usr/local/cuda/lib64" \
./configure --enable-nonfree --enable-cuda-nvcc --nvccflags="-gencode arch=compute_$( echo -n ${CUDA_ARCH_BIN} | tr -d '.'),code=sm_$(echo -n ${CUDA_ARCH_BIN} | tr -d '.') -O2" \
--enable-nvdec --enable-nvenc --enable-libnpp --extra-cflags="-I/usr/local/cuda/include" --extra-ldflags="-L/usr/local/cuda/lib64" \
--enable-gpl --enable-gnutls --enable-libass --enable-libopus --enable-libvorbis \
--enable-libx264 --enable-libx265 --enable-shared --enable-static --enable-libpulse && \
--enable-libx264 --enable-libx265 --enable-shared --enable-static --enable-libpulse ; cat ffbuild/config.log && \
make -j$(nproc --ignore=4) && make install && ldconfig && make clean && \
cd .. && rm -rf FFmpeg-n${FFMPEG_RELEASE} ffmpeg.tar.gz

Expand Down
26 changes: 14 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
VIDEOSDK_RELEASE ?= 9.1.23.2
OPENCV_RELEASE ?= 4.5.5
FFMPEG_RELEASE ?= 4.4.2
UBUNTU_RELEASE ?= 20.04
CUDNN_RELEASE ?= 7.6.5.32-1+cuda10.1
CUDA_PLATFORM ?= ubuntu1804
CUDNN_BRANCH ?= 7
CUDA_RELEASE ?= 10-1
VIDEOSDK_RELEASE ?= 12.2.72.0
OPENCV_RELEASE ?= 4.9.0
FFMPEG_RELEASE ?= 7.0
UBUNTU_RELEASE ?= 24.04
CUDNN_RELEASE ?= 8.9.7.29-1+cuda12.2
CUDA_PLATFORM ?= ubuntu2204
CUDA_ARCH_BIN ?= 8.6
CUDNN_BRANCH ?= 8
CUDA_RELEASE ?= 12-2
BINARIES_DIR ?= /data/bins
IMAGE ?= ubuntu-toolbox
IMAGE ?= ubuntu-toolbox

.PHONY: base
base:
podman build --build-arg "RELEASE=$(UBUNTU_RELEASE)" -t $(IMAGE):$(UBUNTU_RELEASE) -f Dockerfile .
podman build --rm --build-arg "RELEASE=$(UBUNTU_RELEASE)" -t $(IMAGE):$(UBUNTU_RELEASE) -f Dockerfile .

.PHONY: cuda
cuda: base
podman build -t $(IMAGE):$(UBUNTU_RELEASE)-cuda$(subst -,.,$(CUDA_RELEASE)) \
podman build --rm -t $(IMAGE):$(UBUNTU_RELEASE)-cuda$(subst -,.,$(CUDA_RELEASE)) \
--build-arg "BASE_IMAGE=$(IMAGE):$(UBUNTU_RELEASE)" \
--build-arg "CUDA_PLATFORM=$(CUDA_PLATFORM)" \
--build-arg "CUDNN_RELEASE=$(CUDNN_RELEASE)" \
Expand All @@ -28,10 +29,11 @@ cuda: base

.PHONY: dev
dev: cuda
podman build -t $(IMAGE):$(UBUNTU_RELEASE)-dev \
podman build --rm -t $(IMAGE):$(UBUNTU_RELEASE)-dev \
--build-arg "BASE_IMAGE=$(IMAGE):$(UBUNTU_RELEASE)-cuda$(subst -,.,$(CUDA_RELEASE))" \
--build-arg "VIDEOSDK_RELEASE=$(VIDEOSDK_RELEASE)" \
--build-arg "OPENCV_RELEASE=$(OPENCV_RELEASE)" \
--build-arg "FFMPEG_RELEASE=$(FFMPEG_RELEASE)" \
--build-arg "CUDA_ARCH_BIN=$(CUDA_ARCH_BIN)" \
-f Dockerfile.dev .

2 changes: 1 addition & 1 deletion extra-packages
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ zsh
curl
wget
fonts-cantarell
libasound2
alsa-base
alsa-utils
pulseaudio-utils
libx11-xcb1
Expand Down

0 comments on commit feb8ffe

Please sign in to comment.