Commit ecad2125 authored by Peter Hutterer's avatar Peter Hutterer
Browse files

Add support for custom base images with FDO_BASE_IMAGE



By default we start with $distro:$version as the base image onto which
the dependencies are installed. Where FDO_BASE_IMAGE is set we start
with that image instead. This allows for layering of base images, e.g.
gstreamer can generate an image that the gstreamer-plugins then use as
base image for their specific needs.

Fixes: #7
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 670ca3f8
......@@ -158,6 +158,19 @@
#
# If set, the image will be built even if it exists in the registry already
#
# .. attribute:: FDO_BASE_IMAGE
#
# By default, the base image to start with is
{% if version %}
# ``{{distribution}}:{{version}}``
{% else %}
# ``{{distribution}}:$FDO_DISTRIBUTION_VERSION``
{% endif %}
# and all dependencies are installed on top of that base image. If
# ``FDO_BASE_IMAGE`` is given, it references a different base image to start with.
# This image usually requires the full registry path, e.g.
# ``registry.freedesktop.org/projectGroup/projectName/repo_suffix:tag-name``
#
# .. attribute:: FDO_EXPIRES_AFTER
#
# If set, enables an expiration time on the image to
......@@ -205,9 +218,15 @@
- *fdo_distro_exists
- echo Building $FDO_REPO_SUFFIX:$DISTRO_TAG from {{ image }}
- if [[ x"$FDO_BASE_IMAGE" != x"" ]] ;
then
BASE_IMAGE="$FDO_BASE_IMAGE";
else
BASE_IMAGE="{{ image }}";
fi
- echo Building $FDO_REPO_SUFFIX:$DISTRO_TAG from $BASE_IMAGE
# initial set up: take the base image, update it and install the packages
- buildcntr=$(buildah from {{ image }})
- buildcntr=$(buildah from $BASE_IMAGE)
- buildmnt=$(buildah mount $buildcntr)
{% if prepare %}
......
......@@ -143,6 +143,15 @@
#
# If set, the image will be built even if it exists in the registry already
#
# .. attribute:: FDO_BASE_IMAGE
#
# By default, the base image to start with is
# ``alpine:latest``
# and all dependencies are installed on top of that base image. If
# ``FDO_BASE_IMAGE`` is given, it references a different base image to start with.
# This image usually requires the full registry path, e.g.
# ``registry.freedesktop.org/projectGroup/projectName/repo_suffix:tag-name``
#
# .. attribute:: FDO_EXPIRES_AFTER
#
# If set, enables an expiration time on the image to
......@@ -186,9 +195,15 @@
- *fdo_distro_exists
- echo Building $FDO_REPO_SUFFIX:$DISTRO_TAG from alpine:latest
- if [[ x"$FDO_BASE_IMAGE" != x"" ]] ;
then
BASE_IMAGE="$FDO_BASE_IMAGE";
else
BASE_IMAGE="alpine:latest";
fi
- echo Building $FDO_REPO_SUFFIX:$DISTRO_TAG from $BASE_IMAGE
# initial set up: take the base image, update it and install the packages
- buildcntr=$(buildah from alpine:latest)
- buildcntr=$(buildah from $BASE_IMAGE)
- buildmnt=$(buildah mount $buildcntr)
- $BUILDAH_RUN $buildcntr apk update
......
......@@ -143,6 +143,15 @@
#
# If set, the image will be built even if it exists in the registry already
#
# .. attribute:: FDO_BASE_IMAGE
#
# By default, the base image to start with is
# ``arch:rolling``
# and all dependencies are installed on top of that base image. If
# ``FDO_BASE_IMAGE`` is given, it references a different base image to start with.
# This image usually requires the full registry path, e.g.
# ``registry.freedesktop.org/projectGroup/projectName/repo_suffix:tag-name``
#
# .. attribute:: FDO_EXPIRES_AFTER
#
# If set, enables an expiration time on the image to
......@@ -186,9 +195,15 @@
- *fdo_distro_exists
- echo Building $FDO_REPO_SUFFIX:$DISTRO_TAG from archlinux/base
- if [[ x"$FDO_BASE_IMAGE" != x"" ]] ;
then
BASE_IMAGE="$FDO_BASE_IMAGE";
else
BASE_IMAGE="archlinux/base";
fi
- echo Building $FDO_REPO_SUFFIX:$DISTRO_TAG from $BASE_IMAGE
# initial set up: take the base image, update it and install the packages
- buildcntr=$(buildah from archlinux/base)
- buildcntr=$(buildah from $BASE_IMAGE)
- buildmnt=$(buildah mount $buildcntr)
- $BUILDAH_RUN $buildcntr pacman -S --refresh
......
......@@ -149,6 +149,15 @@
#
# If set, the image will be built even if it exists in the registry already
#
# .. attribute:: FDO_BASE_IMAGE
#
# By default, the base image to start with is
# ``centos:$FDO_DISTRIBUTION_VERSION``
# and all dependencies are installed on top of that base image. If
# ``FDO_BASE_IMAGE`` is given, it references a different base image to start with.
# This image usually requires the full registry path, e.g.
# ``registry.freedesktop.org/projectGroup/projectName/repo_suffix:tag-name``
#
# .. attribute:: FDO_EXPIRES_AFTER
#
# If set, enables an expiration time on the image to
......@@ -192,9 +201,15 @@
- *fdo_distro_exists
- echo Building $FDO_REPO_SUFFIX:$DISTRO_TAG from $DISTRO:$DISTRO_VERSION
- if [[ x"$FDO_BASE_IMAGE" != x"" ]] ;
then
BASE_IMAGE="$FDO_BASE_IMAGE";
else
BASE_IMAGE="$DISTRO:$DISTRO_VERSION";
fi
- echo Building $FDO_REPO_SUFFIX:$DISTRO_TAG from $BASE_IMAGE
# initial set up: take the base image, update it and install the packages
- buildcntr=$(buildah from $DISTRO:$DISTRO_VERSION)
- buildcntr=$(buildah from $BASE_IMAGE)
- buildmnt=$(buildah mount $buildcntr)
- $BUILDAH_RUN $buildcntr dnf --help >/dev/null 2>&1 && DNF=dnf || DNF=yum
......
......@@ -149,6 +149,15 @@
#
# If set, the image will be built even if it exists in the registry already
#
# .. attribute:: FDO_BASE_IMAGE
#
# By default, the base image to start with is
# ``debian:$FDO_DISTRIBUTION_VERSION``
# and all dependencies are installed on top of that base image. If
# ``FDO_BASE_IMAGE`` is given, it references a different base image to start with.
# This image usually requires the full registry path, e.g.
# ``registry.freedesktop.org/projectGroup/projectName/repo_suffix:tag-name``
#
# .. attribute:: FDO_EXPIRES_AFTER
#
# If set, enables an expiration time on the image to
......@@ -192,9 +201,15 @@
- *fdo_distro_exists
- echo Building $FDO_REPO_SUFFIX:$DISTRO_TAG from $DISTRO:$DISTRO_VERSION
- if [[ x"$FDO_BASE_IMAGE" != x"" ]] ;
then
BASE_IMAGE="$FDO_BASE_IMAGE";
else
BASE_IMAGE="$DISTRO:$DISTRO_VERSION";
fi
- echo Building $FDO_REPO_SUFFIX:$DISTRO_TAG from $BASE_IMAGE
# initial set up: take the base image, update it and install the packages
- buildcntr=$(buildah from $DISTRO:$DISTRO_VERSION)
- buildcntr=$(buildah from $BASE_IMAGE)
- buildmnt=$(buildah mount $buildcntr)
- cat $buildmnt/etc/apt/sources.list
......
......@@ -149,6 +149,15 @@
#
# If set, the image will be built even if it exists in the registry already
#
# .. attribute:: FDO_BASE_IMAGE
#
# By default, the base image to start with is
# ``fedora:$FDO_DISTRIBUTION_VERSION``
# and all dependencies are installed on top of that base image. If
# ``FDO_BASE_IMAGE`` is given, it references a different base image to start with.
# This image usually requires the full registry path, e.g.
# ``registry.freedesktop.org/projectGroup/projectName/repo_suffix:tag-name``
#
# .. attribute:: FDO_EXPIRES_AFTER
#
# If set, enables an expiration time on the image to
......@@ -192,9 +201,15 @@
- *fdo_distro_exists
- echo Building $FDO_REPO_SUFFIX:$DISTRO_TAG from $DISTRO:$DISTRO_VERSION
- if [[ x"$FDO_BASE_IMAGE" != x"" ]] ;
then
BASE_IMAGE="$FDO_BASE_IMAGE";
else
BASE_IMAGE="$DISTRO:$DISTRO_VERSION";
fi
- echo Building $FDO_REPO_SUFFIX:$DISTRO_TAG from $BASE_IMAGE
# initial set up: take the base image, update it and install the packages
- buildcntr=$(buildah from $DISTRO:$DISTRO_VERSION)
- buildcntr=$(buildah from $BASE_IMAGE)
- buildmnt=$(buildah mount $buildcntr)
- $BUILDAH_RUN $buildcntr dnf upgrade -y --setopt=install_weak_deps=False --nogpgcheck fedora-release fedora-repos*
......
......@@ -149,6 +149,15 @@
#
# If set, the image will be built even if it exists in the registry already
#
# .. attribute:: FDO_BASE_IMAGE
#
# By default, the base image to start with is
# ``ubuntu:$FDO_DISTRIBUTION_VERSION``
# and all dependencies are installed on top of that base image. If
# ``FDO_BASE_IMAGE`` is given, it references a different base image to start with.
# This image usually requires the full registry path, e.g.
# ``registry.freedesktop.org/projectGroup/projectName/repo_suffix:tag-name``
#
# .. attribute:: FDO_EXPIRES_AFTER
#
# If set, enables an expiration time on the image to
......@@ -192,9 +201,15 @@
- *fdo_distro_exists
- echo Building $FDO_REPO_SUFFIX:$DISTRO_TAG from $DISTRO:$DISTRO_VERSION
- if [[ x"$FDO_BASE_IMAGE" != x"" ]] ;
then
BASE_IMAGE="$FDO_BASE_IMAGE";
else
BASE_IMAGE="$DISTRO:$DISTRO_VERSION";
fi
- echo Building $FDO_REPO_SUFFIX:$DISTRO_TAG from $BASE_IMAGE
# initial set up: take the base image, update it and install the packages
- buildcntr=$(buildah from $DISTRO:$DISTRO_VERSION)
- buildcntr=$(buildah from $BASE_IMAGE)
- buildmnt=$(buildah mount $buildcntr)
- echo 'path-exclude=/usr/share/doc/*' > $buildmnt/etc/dpkg/dpkg.cfg.d/99-exclude-cruft
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment