mirror of
https://github.com/versity/scoutfs.git
synced 2026-01-08 04:55:21 +00:00
Automatically handle building scoutfs containers
This commit is contained in:
33
build-container.sh
Executable file
33
build-container.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
export EL_MAJOR_VER="${EL_MAJOR_VER:-9.5}"
|
||||
export EL_VER="${EL_VER:-${EL_MAJOR_VER}}"
|
||||
export MAJOR_VER="${EL_VER%%.*}"
|
||||
export MINOR_VER="${EL_VER#*.}"
|
||||
|
||||
export PUB_OR_VAULT="${PUB_OR_VAULT:-vault}"
|
||||
export FORCE_REBUILD_DOCKER_IMAGE="${FORCE_REBUILD_DOCKER_IMAGE:-false}"
|
||||
|
||||
if [ -z "${MINOR_VER}" ] || [ -z "${MAJOR_VER}" ]; then
|
||||
echo "Major/minor versions could not be inferred from required version ${EL_VER}, bailing out"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${MAJOR_VER}" -gt 7 ]; then
|
||||
IMAGE_BASE="quay.io/rockylinux/rockylinux"
|
||||
IMAGE_VERSION="${MAJOR_VER}.${MINOR_VER}-ubi"
|
||||
else
|
||||
IMAGE_BASE="library/centos"
|
||||
IMAGE_VERSION="centos7.9.2009"
|
||||
fi
|
||||
|
||||
# build fresh 'builder' images only if we don't have them or want to force a rebuild
|
||||
if [ "$(docker images -q scoutfs-builder:el${MAJOR_VER}.${MINOR_VER})" == "" ] || [ "${FORCE_REBUILD_DOCKER_IMAGE}" == "true" ]; then
|
||||
docker_args=()
|
||||
if [[ "${SKIP_CACHE}" == 'true' ]]; then
|
||||
docker_args+=(--no-cache)
|
||||
fi
|
||||
docker build . "${docker_args[@]}" --build-arg PUB_OR_VAULT="${PUB_OR_VAULT}" --build-arg IMAGE_SOURCE="${IMAGE_BASE}:${IMAGE_VERSION}" -t "scoutfs-builder:el${MAJOR_VER}.${MINOR_VER}"
|
||||
fi
|
||||
@@ -7,6 +7,16 @@ export MAJOR_VER="${EL_VER%%.*}"
|
||||
export MINOR_VER="${EL_VER#*.}"
|
||||
export RELEASE="${RELEASE:-0}"
|
||||
export IS_EDGE="${IS_EDGE:-0}"
|
||||
export FORCE_REBUILD_DOCKER_IMAGE="${FORCE_REBUILD_DOCKER_IMAGE:-false}"
|
||||
|
||||
export PUB_OR_VAULT
|
||||
if [ "${IS_EDGE}" = 0 ]; then
|
||||
PUB_OR_VAULT=vault
|
||||
else
|
||||
PUB_OR_VAULT=pub
|
||||
fi
|
||||
|
||||
bash build-container.sh
|
||||
|
||||
for KVER in $(bash build-packages.sh get-kvers); do
|
||||
echo "Building for ${KVER} on ${EL_VER}"
|
||||
|
||||
Reference in New Issue
Block a user