diff --git a/.gitea/install_latest_buildah.sh b/.gitea/install_latest_buildah.sh new file mode 100644 index 0000000..5a4560d --- /dev/null +++ b/.gitea/install_latest_buildah.sh @@ -0,0 +1,2 @@ +apt-get update -qq +apt-get -qq -y install buildah diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..d0e9d7e --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,65 @@ +name: Multiarch build +on: + push: + pull_request: + workflow_dispatch: + schedule: + - cron: '0 0 * * *' # every day at midnight + +env: + PROJECT_DIR: spring-petclinic + MVN_REPO_DIR: ~/.m2/repository + IMAGE_TAG: latest + +jobs: + build-multiarch-scratch: + name: Build multi-architecture image from scratch + env: + IMAGE_NAME: testing-multiarch + DOCKER_DRIVER: overlay2 + runs-on: ubuntu-22.04 + container: + options: --privileged --device /dev/fuse + steps: + + - name: Checkout Buildah action + uses: actions/checkout@v4 + + - name: Install latest buildah + run: | + bash ./.gitea/install_latest_buildah.sh + + - name: Install qemu dependency + run: | + apt-get update + apt-get install -y qemu-user-static + + + - name: Build Image + id: build_image_multiarch + uses: redhat-actions/buildah-build@v2 + with: + image: ${{ env.IMAGE_NAME }} + tags: ${{ env.IMAGE_TAG }} + base-image: 'registry.access.redhat.com/ubi9-minimal:9.5' + archs: amd64, i386, ppc64le + containerfiles: | + ./Containerfile + extra-args: | + --isolation=chroot + port: 8080 + workdir: "." + + - name: Echo Outputs + run: | + echo "Image: ${{ steps.build_image_multiarch.outputs.image }}" + echo "Tags: ${{ steps.build_image_multiarch.outputs.tags }}" + echo "Tagged Image: ${{ steps.build_image_multiarch.outputs.image-with-tag }}" + + - name: Check images created + run: buildah images | grep '${{ env.IMAGE_NAME }}' + + - name: Check manifest + run: | + set -x + buildah manifest inspect ${{ steps.build_image_multiarch.outputs.image }}:${{ env.IMAGE_TAG }} \ No newline at end of file diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..0c16253 --- /dev/null +++ b/Containerfile @@ -0,0 +1,5 @@ +FROM registry.access.redhat.com/ubi9-minimal:9.5 + +RUN yum install -y kubectl \ + && yum clean all \ + && rm -rf /var/cache/yum \ No newline at end of file