Skip to content

Commit 4ed34ee

Browse files
committed
Allow custom repo URLs to used in rocky-container element
1 parent 41f07c5 commit 4ed34ee

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
4+
set -x
5+
fi
6+
set -eu
7+
set -o pipefail
8+
9+
DIB_ROCKY_CONTAINER_STACKHPC_RESTORE_UPSTREAM_REPOFILES=${DIB_ROCKY_CONTAINER_STACKHPC_RESTORE_UPSTREAM_REPOFILES:-"false"}
10+
11+
[ -n "$TARGET_ROOT" ]
12+
13+
# Remove custom repos and disabled upstream repo files
14+
sudo rm -f ${TARGET_ROOT}/etc/yum.repos.d/*.repo
15+
16+
# Conditionally restore upstream repo files
17+
if [[ ${DIB_ROCKY_CONTAINER_STACKHPC_RESTORE_UPSTREAM_REPOFILES} != "false" ]]; then
18+
sudo cp -f ${TARGET_ROOT}/tmp/orig_repos/*.repo ${TARGET_ROOT}/etc/yum.repos.d/
19+
fi
20+
21+
# Cleanup temporary copies of original repo files
22+
sudo rm -rf ${TARGET_ROOT}/tmp/orig_repos

elements/rocky-container-stackhpc/containerfiles/9-stackhpc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
# Based on https://github.com/openstack/diskimage-builder/blob/master/diskimage_builder/elements/rocky-container/containerfiles/9
22

33
FROM docker.io/rockylinux/rockylinux:9
4+
ARG ROCKY_USE_MIRRORS="false"
5+
# Comma-delimited list of repo URLs
6+
ARG ROCKY_MIRROR_URLS
7+
8+
RUN if [[ ${ROCKY_USE_MIRRORS} != "false" ]]; then \
9+
dnf -y install 'dnf-command(config-manager)' && \
10+
mkdir /tmp/orig_repos && cp -f /etc/yum.repos.d/*.repo /tmp/orig_repos/ && \
11+
dnf config-manager --set-disabled '*' && \
12+
for REPO_URL in $( echo ${ROCKY_MIRROR_URLS} | sed 's/,/ /g'); do \
13+
dnf config-manager --add-repo ${REPO_URL}; done && \
14+
dnf --allowerasing -y distro-sync; fi
415

516
RUN dnf group install -y 'Minimal Install' --allowerasing && \
617
dnf install -y findutils util-linux cloud-init

0 commit comments

Comments
 (0)