Skip to content

Commit

Permalink
add multi-platform support for base containers
Browse files Browse the repository at this point in the history
In order to support multi-platform base images,
the image files are extended by the --platform
option and a script to build them is provided.
This addresses issue #437.

Signed-off-by: Michael Engel <[email protected]>
  • Loading branch information
engelmi committed Aug 17, 2023
1 parent e41a109 commit 0567b21
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 3 deletions.
26 changes: 26 additions & 0 deletions build-scripts/build-containers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash -xe
# SPDX-License-Identifier: GPL-2.0-or-later

SCRIPT_DIR=$( realpath "$0" )
SCRIPT_DIR=$(dirname "$SCRIPT_DIR")/
CONTAINER_FILE_DIR=$SCRIPT_DIR"../tests/containers/"

PLATFORMS=linux/amd64,linux/arm64

function build_base(){
podman build --no-cache \
--platform ${PLATFORMS} \
-f ${CONTAINER_FILE_DIR}build-base \
--manifest quay.io/bluechi/build-base .
}

function integration_test_base(){
podman build --no-cache \
--platform ${PLATFORMS} \
-f ${CONTAINER_FILE_DIR}integration-test-base \
--manifest quay.io/bluechi/integration-test-base .
}

echo "Building containers and manifest for $1"
echo ""
$1
15 changes: 14 additions & 1 deletion tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,17 @@ The `integration-test-base` file describes the builder base image that is publis

Both, `integration-test-local` as well as `integration-test-snapshot`, are based on the builder base image for the integration tests and contain compiled products and configurations for integration testing.

**_NOTE:_** Currently, the images are pushed manually to the quay.io container repository. If any updates are required, please reach out to the [code owners](../.github/CODEOWNERS).
### Updating container images in registry

Currently, the base images are pushed manually to the [bluechi on quay.io](https://quay.io/organization/bluechi) organization and its repositories. If any updates are required, please reach out to the [code owners](../.github/CODEOWNERS).

**Note to codeowners:**

The base images [build-base](./containers/build-base) and [integration-test-base](./containers/integration-test-base) can be built for multiple platforms (arm64 and amd64) using the [build-containers.sh](../build-scripts/build-containers.sh) script. It'll build images for the given platforms as well as a manifest with the same name, which can then be pushed to the registry. From the root directory of the project run the following commands:

```bash
# building and publishing build-base image
bash build-scripts/build-containers.sh build_base
podman login -u="someuser" -p="topsecret" quay.io
podman manifest push quay.io/bluechi/build-base:latest docker://quay.io/bluechi/build-base:latest
```
2 changes: 1 addition & 1 deletion tests/containers/build-base
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/centos/centos:stream9
FROM --platform=$TARGETPLATFORM quay.io/centos/centos:stream9

# CRB is required for meson
# EPEL is required for lcov, python3-flake8, python3-html2text and codespell
Expand Down
2 changes: 1 addition & 1 deletion tests/containers/integration-test-base
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/centos/centos:stream9
FROM --platform=$TARGETPLATFORM quay.io/centos/centos:stream9

RUN dnf upgrade --refresh -y --nodocs && \
dnf install --nodocs \
Expand Down

0 comments on commit 0567b21

Please sign in to comment.