Skip to content

Commit c6f6f3a

Browse files
rikgibsonzootalures
authored andcommitted
Add jdk11 build/runtime images (#169)
* Add build for J11 images * Remove JDK9 VM memory options
1 parent c3da760 commit c6f6f3a

5 files changed

Lines changed: 30 additions & 6 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[![CircleCI](https://circleci.com/gh/fnproject/fdk-java.svg?style=svg&circle-token=348bec5610c34421f6c436ab8f6a18e153cb1c01)](https://circleci.com/gh/fnproject/fdk-java)
33

44
This project adds support for writing functions in Java on the [Fn
5-
platform](https://github.com/fnproject/fn), with full support for Java 9
5+
platform](https://github.com/fnproject/fn), with full support for Java 11
66
as the default out of the box.
77

88
# FAQ
@@ -44,7 +44,7 @@ func.yaml created
4444
```
4545

4646
This creates the boilerplate for a new Java Function based on Maven and Oracle
47-
Java 9. The `pom.xml` includes a dependency on the latest version of the Fn
47+
Java 11. The `pom.xml` includes a dependency on the latest version of the Fn
4848
Java FDK that is useful for developing your Java functions.
4949

5050
You can now import this project into your favourite IDE as normal.
@@ -101,7 +101,7 @@ You are now ready to run your Function locally using the Fn CLI tool.
101101
$ fn build
102102
Building image your_dockerhub_account/hello:0.0.1
103103
Sending build context to Docker daemon 14.34kB
104-
Step 1/11 : FROM fnproject/fn-java-fdk-build:jdk9-latest as build-stage
104+
Step 1/11 : FROM fnproject/fn-java-fdk-build:jdk11-latest as build-stage
105105
---> 5435658a63ac
106106
Step 2/11 : WORKDIR /function
107107
---> 37340c5aa451

build.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ mvn -B deploy -DaltDeploymentRepository=localStagingDir::default::file://${REP
3232
(
3333
cd images/build
3434
./docker-build.sh -f Dockerfile-jdk9 -t fnproject/fn-java-fdk-build:jdk9-${BUILD_VERSION} .
35+
./docker-build.sh -f Dockerfile-jdk11 -t fnproject/fn-java-fdk-build:jdk11-${BUILD_VERSION} .
3536
)
3637

3738
(
@@ -42,6 +43,7 @@ mvn -B deploy -DaltDeploymentRepository=localStagingDir::default::file://${REP
4243
(
4344
cd runtime
4445
docker build -f ../images/runtime/Dockerfile-jdk9 -t fnproject/fn-java-fdk:jdk9-${BUILD_VERSION} .
46+
docker build -f ../images/runtime/Dockerfile-jdk11 -t fnproject/fn-java-fdk:jdk11-${BUILD_VERSION} .
4547
)
4648

4749
(
@@ -50,8 +52,7 @@ mvn -B deploy -DaltDeploymentRepository=localStagingDir::default::file://${REP
5052
./docker-build.sh ${workdir}
5153
)
5254

53-
5455
(
5556
cd images/init-native
5657
./docker-build.sh
57-
)
58+
)

images/build/Dockerfile-jdk11

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM maven:3-jdk-11-slim
2+
3+
ARG FN_REPO_URL
4+
5+
ADD pom.xml /tmp/cache-deps/pom.xml
6+
ADD cache-deps.sh /tmp/cache-deps/cache-deps.sh
7+
ADD src /tmp/cache-deps/src
8+
RUN /tmp/cache-deps/cache-deps.sh

images/runtime/Dockerfile-jdk11

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM openjdk:11-jdk-slim
2+
COPY target/runtime-*.jar target/dependency/*.jar /function/runtime/
3+
COPY src/main/c/libfnunixsocket.so /function/runtime/lib/
4+
5+
RUN ["/usr/bin/java", "-Xshare:dump"]
6+
7+
# The UseExeperimentalVMOptions, UseCGroupMemoryLimitForHeap and MaxRAMFraction options that were used in the JDK 9 builds are
8+
# no longer supported in JDK 11 - so these have been removed. We now rely on the built-in ContainerSupport option that Linux JDKs
9+
# use to configure themselves when detecting they are running in a container.
10+
#
11+
# SerialGC is used here as it's likely that we'll be running many JVMs on the same host machine and it's also likely
12+
# that the number of JVMs will outnumber the number of available processors.
13+
#
14+
ENTRYPOINT [ "/usr/bin/java", "-XX:-UsePerfData", "-XX:+UseSerialGC", "-Xshare:on", \
15+
"-Djava.library.path=/function/runtime/lib", "-cp", "/function/app/*:/function/runtime/*", "com.fnproject.fn.runtime.EntryPoint" ]

integration-tests/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ and runtime images:
3434
```
3535
cd runtime
3636
docker build -t fnproject/fn-java-fdk .
37-
docker build -f Dockerfile-jdk9 -t fnproject/fn-java-fdk:jdk9-latest .
37+
docker build -f Dockerfile-jdk11 -t fnproject/fn-java-fdk:jdk11-latest .
3838
```
3939

4040
Finally you can run the integration tests:

0 commit comments

Comments
 (0)