forked from knative-extensions/eventing-kafka-broker
-
Notifications
You must be signed in to change notification settings - Fork 6
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
[release-v1.15] Dockerfiles and build changes for hermetic Java builds #1287
Merged
pierDipi
merged 1 commit into
openshift-knative:release-v1.15
from
pierDipi:dockerfiles-java-hermetic-builds
Sep 30, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
openshift/ci-operator/static-images/dispatcher/hermetic/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# | ||
# Copyright © 2018 Knative Authors (knative-dev@googlegroups.com) | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
ARG JAVA_BUILDER=registry.access.redhat.com/ubi8/openjdk-21 | ||
ARG JAVA_RUNTIME=registry.access.redhat.com/ubi8/openjdk-21-runtime | ||
ARG DEPS_IMAGE | ||
ARG VERSION="" | ||
|
||
FROM $DEPS_IMAGE AS deps | ||
|
||
FROM $JAVA_BUILDER AS builder | ||
|
||
USER root | ||
|
||
WORKDIR /build | ||
|
||
COPY --from=deps /third_party/maven/ /third_party/maven/ | ||
|
||
COPY /data-plane . | ||
|
||
RUN mvn -Dmaven.repo.local=/third_party/maven --offline package -pl=dispatcher-loom -Drelease -am -DskipTests --no-transfer-progress | ||
|
||
RUN mkdir /app && cp /build/dispatcher-loom/target/dispatcher-loom-1.0-SNAPSHOT.jar /app/app.jar | ||
|
||
FROM $JAVA_RUNTIME AS running | ||
|
||
USER 185 | ||
|
||
LABEL \ | ||
com.redhat.component="openshift-serverless-1-eventing-kafka-broker-dispatcher-rhel8-container" \ | ||
name="openshift-serverless-1/eventing-kafka-broker-dispatcher-rhel8" \ | ||
version=$VERSION \ | ||
summary="Red Hat OpenShift Serverless 1 Eventing Kafka Broker Dispatcher" \ | ||
maintainer="serverless-support@redhat.com" \ | ||
description="Red Hat OpenShift Serverless 1 Eventing Kafka Broker Dispatcher" \ | ||
io.k8s.display-name="Red Hat OpenShift Serverless 1 Eventing Kafka Broker Dispatcher" \ | ||
io.k8s.description="Red Hat OpenShift Serverless Eventing Kafka Broker Dispatcher" \ | ||
io.openshift.tags=dispatcher | ||
|
||
COPY --from=builder /app /app | ||
|
||
ENTRYPOINT ["java", "-jar", "/app/app.jar"] |
34 changes: 34 additions & 0 deletions
34
openshift/ci-operator/static-images/dispatcher/hermetic/Dockerfile.deps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# | ||
# Copyright © 2018 Knative Authors (knative-dev@googlegroups.com) | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
ARG JAVA_BUILDER=registry.access.redhat.com/ubi8/openjdk-21 | ||
|
||
FROM $JAVA_BUILDER | ||
|
||
USER root | ||
|
||
WORKDIR /build | ||
|
||
COPY /data-plane/pom.xml . | ||
COPY /data-plane/core/pom.xml core/pom.xml | ||
COPY /data-plane/receiver/pom.xml receiver/pom.xml | ||
COPY /data-plane/receiver-loom/pom.xml receiver-loom/pom.xml | ||
COPY /data-plane/dispatcher/pom.xml dispatcher/pom.xml | ||
COPY /data-plane/dispatcher-loom/pom.xml dispatcher-loom/pom.xml | ||
COPY /data-plane/contract/pom.xml contract/pom.xml | ||
|
||
RUN mvn package dependency:go-offline -Drelease -DskipTests -Dmaven.repo.local=/third_party/maven | ||
RUN find /third_party/maven/ -path "*_remote.repositories" | xargs -I{} rm {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
openshift/ci-operator/static-images/receiver/hermetic/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# | ||
# Copyright © 2018 Knative Authors (knative-dev@googlegroups.com) | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
ARG JAVA_BUILDER=registry.access.redhat.com/ubi8/openjdk-21 | ||
ARG JAVA_RUNTIME=registry.access.redhat.com/ubi8/openjdk-21-runtime | ||
ARG DEPS_IMAGE | ||
ARG VERSION="" | ||
|
||
FROM $DEPS_IMAGE AS deps | ||
|
||
FROM $JAVA_BUILDER AS builder | ||
|
||
USER root | ||
|
||
WORKDIR /build | ||
|
||
COPY --from=deps /third_party/maven/ /third_party/maven/ | ||
|
||
COPY /data-plane . | ||
|
||
RUN mvn -Dmaven.repo.local=/third_party/maven --offline package -pl=receiver-loom -Drelease -am -DskipTests --no-transfer-progress | ||
|
||
RUN mkdir /app && cp /build/receiver-loom/target/receiver-loom-1.0-SNAPSHOT.jar /app/app.jar | ||
|
||
FROM $JAVA_RUNTIME AS running | ||
|
||
USER 185 | ||
|
||
LABEL \ | ||
com.redhat.component="openshift-serverless-1-eventing-kafka-broker-receiver-rhel8-container" \ | ||
name="openshift-serverless-1/eventing-kafka-broker-receiver-rhel8" \ | ||
version=$VERSION \ | ||
summary="Red Hat OpenShift Serverless 1 Eventing Kafka Broker Receiver" \ | ||
maintainer="serverless-support@redhat.com" \ | ||
description="Red Hat OpenShift Serverless 1 Eventing Kafka Broker Receiver" \ | ||
io.k8s.display-name="Red Hat OpenShift Serverless 1 Eventing Kafka Broker Receiver" \ | ||
io.k8s.description="Red Hat OpenShift Serverless Eventing Kafka Broker Receiver" \ | ||
io.openshift.tags=receiver | ||
|
||
COPY --from=builder /app /app | ||
|
||
ENTRYPOINT ["java", "-jar", "/app/app.jar"] |
34 changes: 34 additions & 0 deletions
34
openshift/ci-operator/static-images/receiver/hermetic/Dockerfile.deps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# | ||
# Copyright © 2018 Knative Authors (knative-dev@googlegroups.com) | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
ARG JAVA_BUILDER=registry.access.redhat.com/ubi8/openjdk-21 | ||
|
||
FROM $JAVA_BUILDER | ||
|
||
USER root | ||
|
||
WORKDIR /build | ||
|
||
COPY /data-plane/pom.xml . | ||
COPY /data-plane/core/pom.xml core/pom.xml | ||
COPY /data-plane/receiver/pom.xml receiver/pom.xml | ||
COPY /data-plane/receiver-loom/pom.xml receiver-loom/pom.xml | ||
COPY /data-plane/dispatcher/pom.xml dispatcher/pom.xml | ||
COPY /data-plane/dispatcher-loom/pom.xml dispatcher-loom/pom.xml | ||
COPY /data-plane/contract/pom.xml contract/pom.xml | ||
|
||
RUN mvn package dependency:go-offline -Drelease -DskipTests -Dmaven.repo.local=/third_party/maven | ||
RUN find /third_party/maven/ -path "*_remote.repositories" | xargs -I{} rm {} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason for not updating openshift/ci-operator/static-images/dispatcher/Dockerfile instead? Is it that we don't have the DEPS_IMAGE in prow-ci?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also not sure if this is then detected by konflux-gen (as we need the path to this Dockerfile in the component yaml), because IIRC we get the Konflux components out of the ci-configs images section 🤔
But I probably miss something here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah found it: https://github.com/openshift-knative/hack/pull/304/files#diff-887f71c262ff6be15cc30b617c94ee85667e3ccd67aa71b7cbacd4470b031716R253.
You updated the konflux-gen for this...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, in prow CI there isn't a way of doing "dependent builds", so we need to have separate Dockerfiles for Konflux
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah ok. Thanks for clarifying
/lgtm