Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎁 Support for UBI 8 and 9 #228

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 86 additions & 29 deletions .github/workflows/build-images.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,102 @@
name: Continuous Integration Build
name: Build

on:
pull_request:
branches:
- main
push:
branches:
- main
cescoffier marked this conversation as resolved.
Show resolved Hide resolved
paths-ignore:
- '.build/**'
deployment:
schedule:
- cron: '0 0 * * 0'
workflow_dispatch:

jobs:

build-images:
name: Build images
name: Build and Push images
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should not push by default.

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: "base images"
modules: "quarkus-distroless-base-image,quarkus-micro-base-image"
args: ""
- name: "s2i images"
modules: "quarkus-binary-s2i,quarkus-native-s2i"
args: ""
- name: "mandrel builder images"
modules: "quarkus-mandrel-builder-image"
args: ""
- name: "mandrel builder images 21 and 22.0"
modules: "quarkus-mandrel-builder-image"
args: "-Polder-mandrel"
- name: "graalvm ce builder images"
modules: "quarkus-graalvm-builder-image"
args: ""
- name: "graalvm ce builder images 21 and 22.0"
modules: "quarkus-graalvm-builder-image"
args: "-Polder-graalvm"
# Distroless image
- modules: quarkus-distroless-base-image

# Default UBI base image
- modules: quarkus-micro-base-image
ubi: default
- modules: quarkus-binary-s2i,quarkus-native-s2i
ubi: default
- modules: quarkus-mandrel-builder-image
ubi: default
- modules: quarkus-mandrel-builder-image
args: -Polder-mandrel
ubi: default
- modules: quarkus-graalvm-builder-image
ubi: default
- modules: quarkus-graalvm-builder-image
args: -Polder-graalvm
ubi: default

# UBI 9 base image
- modules: quarkus-micro-base-image
ubi: "9.1"
- modules: quarkus-binary-s2i,quarkus-native-s2i
ubi: "9.1"
- modules: quarkus-mandrel-builder-image
ubi: "9.1"
- modules: quarkus-mandrel-builder-image
args: -Polder-mandrel
ubi: "9.1"
- modules: quarkus-graalvm-builder-image
ubi: "9.1"
- modules: quarkus-graalvm-builder-image
args: -Polder-graalvm
ubi: "9.1"

steps:
- run: |
- id: prepare
run: |
# Re-claim some disk space
sudo swapoff -a
sudo rm -f /swapfile
sudo apt-get clean
docker rmi $(docker image ls -aq)
docker image ls -aq | xargs -r docker rmi
df -h
- uses: actions/checkout@v1

# Set up UBI params
if [ -n "${{ matrix.ubi }}" ] && [ "${{ matrix.ubi }}" != "default" ]; then
IFS='.' read -r ubi_major ubi_minor <<< "${{ matrix.ubi }}"
echo "ubi-args=-Dubi.tag=ubi${ubi_major} -Dubi.rel.major=${ubi_major} -Dubi.rel.minor=${ubi_minor}" >> "$GITHUB_OUTPUT"
else
echo "ubi-args=" >> "$GITHUB_OUTPUT"
cardil marked this conversation as resolved.
Show resolved Hide resolved
fi

# Should publish images?
publish_types=(deployment schedule workflow_dispatch)
inarray=$(echo ${publish_types[@]} | grep -o "${{ github.event_name }}" | wc -w)
if (( inarray )) || \
[ "${{ github.event_name }}" == "push" ] && \
[ "${{ github.repository }}" == 'quarkusio/quarkus-images' ] && \
[ "${{ github.ref }}" == 'main' ]; then
echo "publish=true" >> "$GITHUB_OUTPUT"
echo 'publish-args=-Ppush' >> "$GITHUB_OUTPUT
else
echo "publish=false" >> "$GITHUB_OUTPUT"
echo 'publish-args=' >> "$GITHUB_OUTPUT
fi
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2
with:
install: true
- name: Inspect builder
Expand All @@ -65,8 +106,24 @@ jobs:
echo "Status: ${{ steps.buildx.outputs.status }}"
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
- name: Build ${{ matrix.name }}
run: mvn install --projects ${{ matrix.modules }} --also-make -DskipTests ${{ matrix.args }}

- name: Login to GitHub Container Registry
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a workflow for push.

With this, it would push PR and main builds. We want push to be explicit.

if: ${{ steps.prepare.outputs.publish == 'true' }}
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_TOKEN }}

- name: Build ${{ matrix.name }} on ${{ matrix.ubi }}
run:
mvn install
--projects ${{ matrix.modules }}
--also-make
-DskipTests
${{ matrix.args }}
${{ steps.prepare.outputs.ubi-args }}
cardil marked this conversation as resolved.
Show resolved Hide resolved
${{ steps.prepare.outputs.publish-args }}
- name: Print ${{ matrix.name}}
if: always()
run: docker images
74 changes: 0 additions & 74 deletions .github/workflows/push-images.yml

This file was deleted.

15 changes: 11 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,17 @@
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>

<!-- See https://catalog.redhat.com/software/containers/ubi8/ubi-minimal/5c359a62bed8bd75a2c3fba8 -->
<ubi-min.base>registry.access.redhat.com/ubi8/ubi-minimal:8.7</ubi-min.base>
<!-- See https://catalog.redhat.com/software/containers/ubi8/ubi-micro/5ff3f50a831939b08d1b832a -->
<ubi-micro.base>registry.access.redhat.com/ubi8-micro:8.7</ubi-micro.base>
<!-- ubi-minimal: https://catalog.redhat.com/software/containers/ubi8/ubi-minimal/5c359a62bed8bd75a2c3fba8 -->
<!-- ubi-micro: https://catalog.redhat.com/software/containers/ubi8/ubi-micro/5ff3f50a831939b08d1b832a -->
<ubi.rel.major>8</ubi.rel.major>
<ubi.rel.minor>7</ubi.rel.minor>
cardil marked this conversation as resolved.
Show resolved Hide resolved

<!-- Will be used as a prefix to the output image name -->
<ubi.tag>ubi</ubi.tag>
<ubi.release>${ubi.rel.major}.${ubi.rel.minor}</ubi.release>

<ubi-min.base>registry.access.redhat.com/ubi${ubi.rel.major}/ubi-minimal:${ubi.release}</ubi-min.base>
<ubi-micro.base>registry.access.redhat.com/ubi${ubi.rel.major}-micro:${ubi.release}</ubi-micro.base>

<jdock.dry-run>false</jdock.dry-run>
</properties>
Expand Down
2 changes: 1 addition & 1 deletion quarkus-binary-s2i/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<args>
<argument>--dockerfile-dir=${project.basedir}/target/docker</argument>
<argument>--ubi-minimal=${ubi-min.base}</argument>
<argument>--out=quay.io/quarkus/ubi-quarkus-native-binary-s2i:2.0</argument>
<argument>--out=quay.io/quarkus/${ubi.tag}-quarkus-native-binary-s2i:2.0</argument>
<argument>--basedir=${project.basedir}</argument>
<argument>--dry-run=${jdock.dry-run}</argument>
</args>
Expand Down
2 changes: 1 addition & 1 deletion quarkus-graalvm-builder-image/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<args>
<argument>--dockerfile-dir=${project.basedir}/target/docker</argument>
<argument>--ubi-minimal=${ubi-min.base}</argument>
<argument>--out=quay.io/quarkus/ubi-quarkus-graalvmce-builder-image</argument>
<argument>--out=quay.io/quarkus/${ubi.tag}-quarkus-graalvmce-builder-image</argument>
<argument>--in=${images.file}</argument>
<argument>--dry-run=${jdock.dry-run}</argument>
</args>
Expand Down
2 changes: 1 addition & 1 deletion quarkus-mandrel-builder-image/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<args>
<argument>--dockerfile-dir=${project.basedir}/target/docker</argument>
<argument>--ubi-minimal=${ubi-min.base}</argument>
<argument>--out=quay.io/quarkus/ubi-quarkus-mandrel-builder-image</argument>
<argument>--out=quay.io/quarkus/${ubi.tag}-quarkus-mandrel-builder-image</argument>
<argument>--in=${images.file}</argument>
<argument>--dry-run=${jdock.dry-run}</argument>
</args>
Expand Down
1 change: 1 addition & 0 deletions quarkus-micro-base-image/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<argument>--dockerfile-dir=${pom.basedir}/target/docker</argument>
<argument>--ubi-minimal=${ubi-min.base}</argument>
<argument>--ubi-micro=${ubi-micro.base}</argument>
<argument>--ubi-tag=${ubi.tag}</argument>
<argument>--out=quay.io/quarkus/quarkus-micro-image:2.0</argument>
<argument>--dry-run=${jdock.dry-run}</argument>
</args>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public class Build implements Callable<Integer> {
@CommandLine.Option(names = { "--ubi-micro" }, description = "The UBI Micro base image")
private String micro;

@CommandLine.Option(names = { "--ubi-tag" }, description = "The tag to add to the output image tag")
private String ubiTag;

@CommandLine.Option(names = { "--out" }, description = "The output image")
private String output;

Expand All @@ -31,7 +34,7 @@ public class Build implements Callable<Integer> {
@Override
public Integer call() throws Exception {
JDock.setDockerFileDir(dockerFileDir);
QuarkusMicro.define(minimal, micro, output)
QuarkusMicro.define(minimal, micro, output, ubiTag)
.buildLocalImages(dryRun);

return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public class Push implements Callable<Integer> {
@CommandLine.Option(names = { "--ubi-micro" }, description = "The UBI Micro base image")
private String micro;

@CommandLine.Option(names = { "--ubi-tag" }, description = "The tag to add to the output image tag")
private String ubiTag;

@CommandLine.Option(names = { "--out" }, description = "The output image")
private String output;

Expand All @@ -31,7 +34,7 @@ public class Push implements Callable<Integer> {
@Override
public Integer call() throws Exception {
JDock.setDockerFileDir(dockerFileDir);
QuarkusMicro.define(minimal, micro, output)
QuarkusMicro.define(minimal, micro, output, ubiTag)
.buildAndPush();
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@

public class QuarkusMicro {

static MultiArchImage define(String minimal, String micro, String output) {
static MultiArchImage define(String minimal, String micro, String output, String ubiTag) {
MultiStageDockerFile img = Dockerfile.multistages()
.stage("ubi", Dockerfile.from(minimal))
.stage("scratch", Dockerfile.from(micro))
.stage(Dockerfile.from("scratch")
.copyFromStage("ubi", "/usr/lib64/libgcc_s.so.1")
.copyFromStage("ubi", "/usr/lib64/libstdc++.so.6")
.copyFromStage("ubi", "/usr/lib64/libz.so.1"));
if (!"ubi".equals(ubiTag)) {
output = output + '-' + ubiTag;
}
return new MultiArchImage(output, Map.of(
"arm64", img,
"amd64", img));
Expand Down
2 changes: 1 addition & 1 deletion quarkus-native-s2i/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<args>
<argument>--dockerfile-dir=${project.basedir}/target/docker</argument>
<argument>--ubi-minimal=${ubi-min.base}</argument>
<argument>--out=quay.io/quarkus/ubi-quarkus-graalvmce-s2i</argument>
<argument>--out=quay.io/quarkus/${ubi.tag}-quarkus-graalvmce-s2i</argument>
<argument>--in=${project.basedir}/graalvm.yaml</argument>
<argument>--basedir=${project.basedir}</argument>
<argument>--dry-run=${jdock.dry-run}</argument>
Expand Down