Skip to content

Commit

Permalink
Add minimal ubi8 container
Browse files Browse the repository at this point in the history
Signed-off-by: Evan Lezar <[email protected]>
  • Loading branch information
elezar committed Jul 9, 2024
1 parent 68d61e1 commit 3b184e2
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
43 changes: 43 additions & 0 deletions deployments/container/Dockerfile.ubi8
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2024 NVIDIA CORPORATION
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM redhat/ubi8-minimal AS minimal

RUN rpm -qa --queryformat='^%{NAME}-\[0-9\].*\.%{ARCH}$\n' | sort -u > /tmp/minimal-list.txt
RUN rpm -qa | sort -u > /tmp/minimal-list.versions

FROM nvidia/cuda:12.5.0-base-ubi8

RUN rm -f /etc/dnf/protected.d/*.conf && \
echo "install_weak_deps=False" >> /etc/dnf/dnf.conf

RUN dnf remove -y cuda* \
systemd && \
dnf clean all \
&& \
dnf install -y microdnf \
&& \
rm -f /etc/yum.repos.d/cuda.repo && \
rm -f /etc/ld.so.conf.d/nvidia.conf && \
dnf update -y && \
rm -rf /var/cache/dnf

COPY --from=minimal /tmp/minimal-list.txt /tmp/minimal-list.txt
COPY --from=minimal /tmp/minimal-list.versions /tmp/minimal-list.versions

COPY cleanup.sh .
RUN ./cleanup.sh

RUN microdnf upgrade
RUN rpm -qa | sort -u > /tmp/package-list.versions
28 changes: 28 additions & 0 deletions deployments/container/cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
# Copyright 2024 NVIDIA CORPORATION
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express orimplied.
# See the License for the specific language governing permissions and
# limitations under the License.

dnf install -y microdnf

microdnf remove $(rpm -q --whatrequires dnf)
rpm -e dnf

microdnf remove \
$(rpm -q --whatrequires /usr/libexec/platform-python) \
$(rpm -q --whatrequires 'python(abi)') \
python* \
dnf*

microdnf remove \
$(rpm -qa | sort | grep -v -f /tmp/minimal-list.txt -e gpg-pubkey)

0 comments on commit 3b184e2

Please sign in to comment.