containers: simplify Dockerfile and container build

This changes the following:
 - Only produce one container. There is no particular benefit to
   supporting several different base containers, so unify on ubi
   as that is what we need ourselves.
 - Build directly from git. Now that the RPM we include in our
   container does not have any dependencies and only contains a
   couple of executables, the indirection via RPM has less value.
   Eventually the value will be reduced even further as we merge
   the entrypoint into the main binary and move dnf-json into the
   worker, leaving us with only a go binary. The only potential
   benefit might be that the build environment of RPMs is more
   clearly defined, but there is no real reason to believe that
   our mockbuild is any better than using the UBI golang build
   container.

This simplifies the container builds, and brings us more in line
with what is done in image-builder, and what is needed to deploy
to openshift.
This commit is contained in:
Tom Gundersen 2020-12-18 01:06:52 +01:00 committed by Sanne Raymaekers
parent c9077c8a7f
commit c3185466ae
3 changed files with 24 additions and 125 deletions

View file

@ -2,68 +2,20 @@
set -euo pipefail
# Query host information.
echo "Query host"
ARCH=$(uname -m)
COMMIT=$(git rev-parse HEAD)
# Populate our build matrix.
IMG_TAGS=(
"quay.io/osbuild/osbuild-composer:f32-${COMMIT}"
"quay.io/osbuild/osbuild-composer:f33-${COMMIT}"
"quay.io/osbuild/osbuild-composer:ubi8-${COMMIT}"
)
IMG_PATHS=(
"./containers/osbuild-composer/"
"./containers/osbuild-composer/"
"./containers/osbuild-composer/"
)
IMG_FROMS=(
"docker.io/library/fedora:32"
"docker.io/library/fedora:33"
"registry.access.redhat.com/ubi8"
)
IMG_RPMREPOS=(
"http://osbuild-composer-repos.s3-website.us-east-2.amazonaws.com/osbuild-composer/fedora-32/${ARCH}/${COMMIT}"
"http://osbuild-composer-repos.s3-website.us-east-2.amazonaws.com/osbuild-composer/fedora-33/${ARCH}/${COMMIT}"
"http://osbuild-composer-repos.s3-website.us-east-2.amazonaws.com/osbuild-composer/rhel-8.3/${ARCH}/${COMMIT}"
)
IMG_COUNT=${#IMG_TAGS[*]}
# Prepare host system.
echo "Prepare host system"
sudo dnf -y install podman
# Build the entire matrix.
echo "Build containers"
echo "Build container"
for ((i=0; i<IMG_COUNT; i++))
do
i_tag=${IMG_TAGS[$i]}
i_path=${IMG_PATHS[$i]}
i_from=${IMG_FROMS[$i]}
i_rpmrepo=${IMG_RPMREPOS[$i]}
echo
echo "-- Build #$i -------------------"
echo "Tag: ${i_tag}"
echo "Arch: ${ARCH}"
echo "Path: ${i_path}"
echo "From: ${i_from}"
echo "RpmRepo: ${i_rpmrepo}"
echo "--------------------------------"
echo
podman \
build \
"--build-arg=OSB_FROM=${i_from}" \
"--build-arg=OSB_RPMREPO=${i_rpmrepo}" \
"--tag=${i_tag}" \
"${i_path}"
echo
done
podman \
build \
"--file=distribution/Dockerfile-ubi" \
"--tag=osbuild-composer:${COMMIT}" \
.