Skip to content

Commit 72eb8ee

Browse files
committed
Move operator maven build into docker
This aligns it with the main proxy image. To make this easier we move the Dockerfile to the top directory as it needs to build the maven project from the top. Signed-off-by: Robert Young <[email protected]>
1 parent 87eddb4 commit 72eb8ee

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

.github/workflows/docker.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,11 @@ jobs:
5555
build-args: |
5656
KROXYLICIOUS_VERSION=${{ env.RELEASE_VERSION }}
5757
tags: ${{ env.PROXY_IMAGE }}:${{ env.RELEASE_VERSION }}
58-
- name: Maven build operator code
59-
run: |
60-
mvn package --projects :kroxylicious-operator --also-make -DskipTests -B
6158
- name: Build and maybe push Operator image
6259
uses: docker/build-push-action@v6
6360
with:
64-
context: ./kroxylicious-operator/
61+
context: .
62+
file: ./Dockerfile.operator
6563
platforms: linux/amd64,linux/arm64
6664
push: ${{ endsWith(env.RELEASE_VERSION, 'SNAPSHOT') }}
6765
build-args: |
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
# Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
55
#
66

7+
from registry.access.redhat.com/ubi9/openjdk-17:1.20 as builder
8+
9+
user root
10+
workdir /opt/kroxylicious
11+
copy . .
12+
run mvn -q -B clean package -Pdist -Dquick
13+
user 185
14+
715
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.2
816

917
ARG JAVA_VERSION=17
@@ -46,7 +54,7 @@ RUN set -ex; \
4654
chmod +x /usr/bin/tini; \
4755
fi
4856

49-
COPY target/kroxylicious-operator-${KROXYLICIOUS_VERSION}-bin/kroxylicious-operator-${KROXYLICIOUS_VERSION} /opt/kroxylicious-operator
57+
COPY --from=builder /opt/kroxylicious/kroxylicious-operator/target/kroxylicious-operator-${KROXYLICIOUS_VERSION}-bin/kroxylicious-operator-${KROXYLICIOUS_VERSION} /opt/kroxylicious-operator
5058

5159
RUN if [[ -n "${CURRENT_USER}" && "${CURRENT_USER}" != "root" ]] ; then groupadd -r -g "${CURRENT_USER_UID}" "${CURRENT_USER}" && useradd -m -r -u "${CURRENT_USER_UID}" -g "${CURRENT_USER}" "${CURRENT_USER}"; fi
5260

scripts/run-operator.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77

88
# simple script to build and run the operator
99
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" || exit
10-
cd ..
11-
echo "building operator maven project"
12-
mvn package --projects :kroxylicious-operator --also-make -DskipTests
13-
cd kroxylicious-operator || exit
10+
cd .. || exit
1411

1512
if ! minikube status
1613
then
@@ -20,8 +17,9 @@ fi
2017

2118
echo "building operator image in minikube"
2219
KROXYLICIOUS_VERSION=${KROXYLICIOUS_VERSION:-$(mvn org.apache.maven.plugins:maven-help-plugin:3.4.0:evaluate -Dexpression=project.version -q -DforceStdout)}
23-
minikube image build . -t quay.io/kroxylicious/operator:latest --build-opt=build-arg=KROXYLICIOUS_VERSION="${KROXYLICIOUS_VERSION}"
20+
minikube image build . -f Dockerfile.operator -t quay.io/kroxylicious/operator:latest --build-opt=build-arg=KROXYLICIOUS_VERSION="${KROXYLICIOUS_VERSION}"
2421

22+
cd kroxylicious-operator || exit
2523
echo "installing kafka (no-op if already installed)"
2624
kubectl create namespace kafka
2725
kubectl create -n kafka -f 'https://strimzi.io/install/latest?namespace=kafka'

0 commit comments

Comments
 (0)