Browse Source

restructure the script

main
Nicolas Massé 2 weeks ago
parent
commit
a1e32b7c39
  1. 13
      build.sh

13
build.sh

@ -2,16 +2,25 @@
set -Eeuo pipefail set -Eeuo pipefail
# Compute podman command line arguments
declare -a PODMAN_ARGS=()
# Inject the desired CentOS Stream version as build arguments
declare CENTOS_VERSION="10" declare CENTOS_VERSION="10"
PODMAN_ARGS+=( --arg CENTOS_VERSION="${CENTOS_VERSION}" --arg EPEL_VERSION="${CENTOS_VERSION}" )
# Tag the resulting image with the current date
declare TS="$(date -I)" declare TS="$(date -I)"
declare -a PODMAN_ARGS=() PODMAN_ARGS+=( -t "localhost/mirrors/centos-stream-${CENTOS_VERSION}:${TS}" )
# Run rsync on the previous dataset if available, to speed up transfer and save on storage. # Run rsync on the previous dataset if available, to speed up transfer and save on storage.
if podman image inspect "localhost/mirrors/centos-stream-${CENTOS_VERSION}:latest" &>/dev/null; then if podman image inspect "localhost/mirrors/centos-stream-${CENTOS_VERSION}:latest" &>/dev/null; then
PODMAN_ARGS+=( --from "localhost/mirrors/centos-stream-${CENTOS_VERSION}:latest" ) PODMAN_ARGS+=( --from "localhost/mirrors/centos-stream-${CENTOS_VERSION}:latest" )
fi fi
podman build -t "localhost/mirrors/centos-stream-${CENTOS_VERSION}:${TS}" "${PODMAN_ARGS[@]}" . # Build the image.
# Note: during the build, the repositories will be synced and the result will be stored in the image.
podman build "${PODMAN_ARGS[@]}" .
podman tag "localhost/mirrors/centos-stream-${CENTOS_VERSION}:${TS}" "localhost/mirrors/centos-stream-${CENTOS_VERSION}:latest" podman tag "localhost/mirrors/centos-stream-${CENTOS_VERSION}:${TS}" "localhost/mirrors/centos-stream-${CENTOS_VERSION}:latest"
# Here you can add the "podman push" command to send the mirror to your registry. # Here you can add the "podman push" command to send the mirror to your registry.

Loading…
Cancel
Save