Skip to content

[release-v1.16] Backport: Update to Java 21 (#74) #22

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

Open
wants to merge 1 commit into
base: release-v1.16
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'
- name: Checkout code
uses: actions/checkout@v4
Expand Down
44 changes: 27 additions & 17 deletions aws-ddb-streams-source/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,23 +114,6 @@

<build>
<plugins>
<plugin>
<groupId>dev.knative.eventing</groupId>
<artifactId>connector-maven-plugin</artifactId>
<version>${project.version}</version>
<configuration>
<kameletName>aws-ddb-streams-source</kameletName>
</configuration>
<executions>
<execution>
<id>generate-connector-spec</id>
<phase>process-classes</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>${quarkus.platform.group-id}</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
Expand All @@ -149,4 +132,31 @@
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>generate-spec</id>
<build>
<plugins>
<plugin>
<groupId>dev.knative.eventing</groupId>
<artifactId>connector-maven-plugin</artifactId>
<version>${project.version}</version>
<configuration>
<kameletName>aws-ddb-streams-source</kameletName>
</configuration>
<executions>
<execution>
<id>generate-connector-spec</id>
<phase>process-classes</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
38 changes: 23 additions & 15 deletions aws-ddb-streams-source/src/main/docker/Dockerfile.jvm
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,13 @@
####
# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode
#
# Before building the container image run:
# Build the image with:
#
# ./mvnw package
#
# Then, build the image with:
#
# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/code-with-quarkus-jvm .
# docker build --load -f aws-ddb-streams-source/src/main/docker/Dockerfile.jvm -t knative-eventing/aws-ddb-streams-source .
#
# Then run the container using:
#
# docker run -i --rm -p 8080:8080 quarkus/code-with-quarkus-jvm
# docker run -i --rm -p 8080:8080 knative-eventing/aws-ddb-streams-source
#
# If you want to include the debug port into your docker image
# you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005.
Expand All @@ -37,7 +33,7 @@
#
# Then run the container using :
#
# docker run -i --rm -p 8080:8080 quarkus/code-with-quarkus-jvm
# docker run -i --rm -p 8080:8080 knative-eventing/aws-ddb-streams-source
#
# This image uses the `run-java.sh` script to run the application.
# This scripts computes the command line to execute your Java application, and
Expand Down Expand Up @@ -94,21 +90,33 @@
# accessed directly. (example: "foo.example.com,bar.example.com")
#
###
FROM registry.access.redhat.com/ubi8/openjdk-17:1.16

ENV LANGUAGE='en_US:en'
## Stage 1 : build artifactcs
FROM registry.access.redhat.com/ubi9/openjdk-21:1.21 AS build
COPY --chown=185 --chmod=0755 mvnw /code/build/mvnw
COPY --chown=185 .mvn /code/build/.mvn
COPY --chown=185 pom.xml /code/
COPY --chown=185 aws-ddb-streams-source/pom.xml /code/build/pom.xml
USER 185
WORKDIR /code/build
RUN ./mvnw -B org.apache.maven.plugins:maven-dependency-plugin:3.8.1:go-offline
COPY aws-ddb-streams-source/src /code/build/src
RUN ./mvnw package -am

## Stage 2 : create the docker final image
FROM registry.access.redhat.com/ubi9/openjdk-21-runtime:1.21

ENV LANGUAGE='en_US:en'

# We make four distinct layers so if there are application changes the library layers can be re-used
COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/
COPY --chown=185 target/quarkus-app/*.jar /deployments/
COPY --chown=185 target/quarkus-app/app/ /deployments/app/
COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/
COPY --chown=185 --from=build /code/build/target/quarkus-app/lib/ /deployments/lib/
COPY --chown=185 --from=build /code/build/target/quarkus-app/*.jar /deployments/
COPY --chown=185 --from=build /code/build/target/quarkus-app/app/ /deployments/app/
COPY --chown=185 --from=build /code/build/target/quarkus-app/quarkus/ /deployments/quarkus/

EXPOSE 8080
USER 185
ENV JAVA_OPTS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
ENV JAVA_APP_JAR="/deployments/quarkus-run.jar"

ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ]

34 changes: 22 additions & 12 deletions aws-ddb-streams-source/src/main/docker/Dockerfile.legacy-jar
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,13 @@
####
# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode
#
# Before building the container image run:
# Build the image with:
#
# ./mvnw package -Dquarkus.package.type=legacy-jar
#
# Then, build the image with:
#
# docker build -f src/main/docker/Dockerfile.legacy-jar -t quarkus/code-with-quarkus-legacy-jar .
# docker build --load -f aws-ddb-streams-source/src/main/docker/Dockerfile.legacy-jar -t knative-eventing/aws-ddb-streams-source-legacy-jar .
#
# Then run the container using:
#
# docker run -i --rm -p 8080:8080 quarkus/code-with-quarkus-legacy-jar
# docker run -i --rm -p 8080:8080 knative-eventing/aws-ddb-streams-source-legacy-jar
#
# If you want to include the debug port into your docker image
# you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005.
Expand All @@ -37,7 +33,7 @@
#
# Then run the container using :
#
# docker run -i --rm -p 8080:8080 quarkus/code-with-quarkus-legacy-jar
# docker run -i --rm -p 8080:8080 knative-eventing/aws-ddb-streams-source-legacy-jar
#
# This image uses the `run-java.sh` script to run the application.
# This scripts computes the command line to execute your Java application, and
Expand Down Expand Up @@ -94,13 +90,27 @@
# accessed directly. (example: "foo.example.com,bar.example.com")
#
###
FROM registry.access.redhat.com/ubi8/openjdk-17:1.16

ENV LANGUAGE='en_US:en'
## Stage 1 : build artifactcs
FROM registry.access.redhat.com/ubi9/openjdk-21:1.21 AS build
COPY --chown=185 --chmod=0755 mvnw /code/build/mvnw
COPY --chown=185 .mvn /code/build/.mvn
COPY --chown=185 pom.xml /code/
COPY --chown=185 aws-ddb-streams-source/pom.xml /code/build/pom.xml
USER 185
WORKDIR /code/build
RUN ./mvnw -B org.apache.maven.plugins:maven-dependency-plugin:3.8.1:go-offline
COPY aws-ddb-streams-source/src /code/build/src
RUN ./mvnw package -am -Dquarkus.package.type=legacy-jar

## Stage 2 : create the docker final image
FROM registry.access.redhat.com/ubi9/openjdk-21-runtime:1.21

ENV LANGUAGE='en_US:en'

COPY target/lib/* /deployments/lib/
COPY target/*-runner.jar /deployments/quarkus-run.jar
# We make four distinct layers so if there are application changes the library layers can be re-used
COPY --chown=185 --from=build /code/build/target/lib/* /deployments/lib/
COPY --chown=185 --from=build /code/build/target/*-runner.jar /deployments/quarkus-run.jar

EXPOSE 8080
USER 185
Expand Down
39 changes: 26 additions & 13 deletions aws-ddb-streams-source/src/main/docker/Dockerfile.native
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,40 @@
####
# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode.
#
# Before building the container image run:
# Build the image with:
#
# ./mvnw package -Dnative
#
# Then, build the image with:
#
# docker build -f src/main/docker/Dockerfile.native -t quarkus/code-with-quarkus .
# docker build --load -f aws-ddb-streams-source/src/main/docker/Dockerfile.native -t knative-eventing/aws-ddb-streams-source-native .
#
# Then run the container using:
#
# docker run -i --rm -p 8080:8080 quarkus/code-with-quarkus
# docker run -i --rm -p 8080:8080 knative-eventing/aws-ddb-streams-source-native
#
###
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.8

## Stage 1 : build with maven builder image with native capabilities
FROM quay.io/quarkus/ubi9-quarkus-mandrel-builder-image:jdk-21 AS build
COPY --chown=quarkus:quarkus --chmod=0755 mvnw /code/build/mvnw
COPY --chown=quarkus:quarkus /.mvn /code/build/.mvn
COPY --chown=quarkus:quarkus pom.xml /code/
COPY --chown=quarkus:quarkus aws-ddb-streams-source/pom.xml /code/build/pom.xml
USER quarkus
WORKDIR /code/build
RUN ./mvnw -B org.apache.maven.plugins:maven-dependency-plugin:3.8.1:go-offline
COPY aws-ddb-streams-source/src /code/build/src
RUN ./mvnw package -am -Dnative

## Stage 2 : create the docker final image
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.5
WORKDIR /work/
RUN chown 1001 /work \
&& chmod "g+rwX" /work \
&& chown 1001:root /work
COPY --chown=1001:root target/*-runner /work/application
COPY --from=build /code/build/target/*-runner /work/application

# set up permissions for user `1001`
RUN chmod 775 /work /work/application \
&& chown -R 1001 /work \
&& chmod -R "g+rwX" /work \
&& chown -R 1001:root /work

EXPOSE 8080
USER 1001

ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"]
CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]
39 changes: 26 additions & 13 deletions aws-ddb-streams-source/src/main/docker/Dockerfile.native-micro
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,40 @@
# It reduces the size of the resulting container image.
# Check https://quarkus.io/guides/quarkus-runtime-base-image for further information about this image.
#
# Before building the container image run:
# Build the image with:
#
# ./mvnw package -Dnative
#
# Then, build the image with:
#
# docker build -f src/main/docker/Dockerfile.native-micro -t quarkus/code-with-quarkus .
# docker build --load -f aws-ddb-streams-source/src/main/docker/Dockerfile.native-micro -t knative-eventing/aws-ddb-streams-source-native-micro .
#
# Then run the container using:
#
# docker run -i --rm -p 8080:8080 quarkus/code-with-quarkus
# docker run -i --rm -p 8080:8080 knative-eventing/aws-ddb-streams-source-native-micro
#
###
FROM quay.io/quarkus/quarkus-micro-image:2.0

## Stage 1 : build with maven builder image with native capabilities
FROM quay.io/quarkus/ubi9-quarkus-mandrel-builder-image:jdk-21 AS build
COPY --chown=quarkus:quarkus --chmod=0755 mvnw /code/build/mvnw
COPY --chown=quarkus:quarkus /.mvn /code/build/.mvn
COPY --chown=quarkus:quarkus pom.xml /code/
COPY --chown=quarkus:quarkus aws-ddb-streams-source/pom.xml /code/build/pom.xml
USER quarkus
WORKDIR /code/build
RUN ./mvnw -B org.apache.maven.plugins:maven-dependency-plugin:3.8.1:go-offline
COPY aws-ddb-streams-source/src /code/build/src
RUN ./mvnw package -am -Dnative

## Stage 2 : create the docker final image
FROM quay.io/quarkus/ubi9-quarkus-micro-image:2.0
WORKDIR /work/
RUN chown 1001 /work \
&& chmod "g+rwX" /work \
&& chown 1001:root /work
COPY --chown=1001:root target/*-runner /work/application
COPY --from=build /code/build/target/*-runner /work/application

# set up permissions for user `1001`
RUN chmod 775 /work /work/application \
&& chown -R 1001 /work \
&& chmod -R "g+rwX" /work \
&& chown -R 1001:root /work

EXPOSE 8080
USER 1001

ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"]
CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]
44 changes: 27 additions & 17 deletions aws-s3-sink/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,23 +95,6 @@

<build>
<plugins>
<plugin>
<groupId>dev.knative.eventing</groupId>
<artifactId>connector-maven-plugin</artifactId>
<version>${project.version}</version>
<configuration>
<kameletName>aws-s3-sink</kameletName>
</configuration>
<executions>
<execution>
<id>generate-connector-spec</id>
<phase>process-classes</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>${quarkus.platform.group-id}</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
Expand All @@ -130,4 +113,31 @@
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>generate-spec</id>
<build>
<plugins>
<plugin>
<groupId>dev.knative.eventing</groupId>
<artifactId>connector-maven-plugin</artifactId>
<version>${project.version}</version>
<configuration>
<kameletName>aws-s3-sink</kameletName>
</configuration>
<executions>
<execution>
<id>generate-connector-spec</id>
<phase>process-classes</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Loading