File tree Expand file tree Collapse file tree 3 files changed +44
-0
lines changed
elements/rocky-container-stackhpc Expand file tree Collapse file tree 3 files changed +44
-0
lines changed Original file line number Diff line number Diff line change 2
2
rocky-container-stackhpc
3
3
========================
4
4
Custom containerfiles for usage with ``rocky-container `` builds.
5
+
5
6
Usage:
6
7
Set ``DIB_CONTAINERFILE_DOCKERFILE `` environment variable to custom
7
8
Containerfile path provided by this role, e.g.:
8
9
DIB_CONTAINERFILE_DOCKERFILE: "/opt/kayobe/src/stackhpc-image-elements/elements/rocky-container-stackhpc/containerfiles/9-stackhpc"
10
+
11
+ Set ``ROCKY_USE_MIRRORS=true `` to disable upstream Rocky repository mirrors, and
12
+ set ``ROCKY_MIRROR_URLS `` to a comma-delimited list of repository URLs to build an
13
+ image from. ``ROCKY_MIRROR_URLS `` will be removed from the final image.
14
+
15
+ Set ``DIB_ROCKY_CONTAINER_STACKHPC_RESTORE_UPSTREAM_REPOFILES=true `` to restore the
16
+ upstream Rocky repository mirror configuration in the final image.
Original file line number Diff line number Diff line change
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 repo files
14
+ if [ -d /tmp/orig_repos ]; then
15
+ sudo rm -f ${TARGET_ROOT} /etc/yum.repos.d/* .repo
16
+ fi
17
+
18
+ # Conditionally restore upstream repo files
19
+ if [[ ${DIB_ROCKY_CONTAINER_STACKHPC_RESTORE_UPSTREAM_REPOFILES} != " false" ]]; then
20
+ sudo cp -f ${TARGET_ROOT} /tmp/orig_repos/* .repo ${TARGET_ROOT} /etc/yum.repos.d/
21
+ fi
22
+
23
+ # Cleanup temporary copies of original repo files
24
+ sudo rm -rf ${TARGET_ROOT} /tmp/orig_repos
Original file line number Diff line number Diff line change 1
1
# Based on https://github.com/openstack/diskimage-builder/blob/master/diskimage_builder/elements/rocky-container/containerfiles/9
2
2
3
3
FROM docker.io/rockylinux/rockylinux:9
4
+ ARG ROCKY_USE_CUSTOM_MIRRORS="false"
5
+ # Comma-delimited list of repo URLs
6
+ ARG ROCKY_CUSTOM_MIRROR_URLS
7
+
8
+ RUN if [[ ${ROCKY_USE_CUSTOM_MIRRORS} != "false" ]]; then \
9
+ dnf -y install 'dnf-command(config-manager)' && \
10
+ mkdir /tmp/orig_repos && mv /etc/yum.repos.d/*.repo /tmp/orig_repos/ && \
11
+ for REPO_URL in $(echo ${ROCKY_CUSTOM_MIRROR_URLS} | sed 's/,/ /g'); do \
12
+ dnf config-manager --add-repo ${REPO_URL}; \
13
+ done && \
14
+ dnf --allowerasing -y distro-sync; \
15
+ fi
4
16
5
17
RUN dnf group install -y 'Minimal Install' --allowerasing && \
6
18
dnf install -y findutils util-linux cloud-init
You can’t perform that action at this time.
0 commit comments