Skip to content

Commit a25d409

Browse files
tessellatoralexellis
authored andcommitted
Update the java8 template to honor cgroups memory limits
This commit upgrades the openjdk version to the earliest that supports cgroup memory limits. It also applies the JVM arguments required to enable the support. This change is needed for the JVM to recognize the actual memory made available to it via the container instead of believing it has access to the amount of memory possessed by the node running the container. Signed-off-by: Chad Taylor <[email protected]>
1 parent f954524 commit a25d409

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

template/java8/Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM openjdk:8u121-jdk-alpine as builder
1+
FROM openjdk:8u131-jdk-alpine as builder
22

33
RUN apk --no-cache add curl \
44
&& addgroup -S app && adduser -S -g app app \
@@ -22,7 +22,7 @@ COPY . /home/app/
2222

2323
RUN gradle build
2424

25-
FROM openjdk:8u121-jdk-alpine as ship
25+
FROM openjdk:8u131-jdk-alpine as ship
2626
RUN apk --no-cache add curl \
2727
&& echo "Pulling watchdog binary from Github." \
2828
&& curl -sSL https://github.com/openfaas-incubator/of-watchdog/releases/download/0.4.6/of-watchdog > /usr/bin/fwatchdog \
@@ -41,7 +41,7 @@ ENV upstream_url="http://127.0.0.1:8081"
4141
ENV mode="http"
4242
ENV CLASSPATH="/home/app/entrypoint-1.0/lib/*"
4343

44-
ENV fprocess="java com.openfaas.entrypoint.App"
44+
ENV fprocess="java -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap com.openfaas.entrypoint.App"
4545
EXPOSE 8080
4646

4747
HEALTHCHECK --interval=2s CMD [ -e /tmp/.lock ] || exit 1

0 commit comments

Comments
 (0)