Friday, February 28, 2025

Installing Many dotnet SDKs on Rocky 8 in Early 2025

The Dockerfile:

FROM rockylinux/rockylinux:8.9
ENV container=docker
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \
systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*;
VOLUME [ "/sys/fs/cgroup" ]
CMD ["/usr/sbin/init"]

# Assuming git submodules are in play in a directory named submodules
COPY submodules provision-docker.sh .

RUN bash provision-docker.sh


provision-docker.sh:


#!/usr/bin/env bash

echo "provisioning container"

rpm -Uvh https://packages.microsoft.com/config/rocky/8/packages-microsoft-prod.rpm

dnf update

dnf upgrade -y

dnf install -y epel-release

dnf install -y dotnet-sdk-9.0 dotnet-sdk-8.0 dotnet-sdk-6.0 dotnet-sdk-3.1

# dotnet-sdk-4.0 is just straight up not avaialble at present

Followers