-
Notifications
You must be signed in to change notification settings - Fork 109
/
Copy pathDockerfile-jdk11
44 lines (36 loc) · 1.65 KB
/
Dockerfile-jdk11
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
###########################################
### Build Stage 1 ###
###########################################
FROM maven:3.8.6-openjdk-8-slim AS maven-builder
COPY ./resources/server /usr/src/app
WORKDIR /usr/src/app
RUN mvn clean package
###########################################
### Build Stage 2 ###
###########################################
FROM alpine:latest AS jdk-builder
RUN set -ex \
&& apk add --no-cache openjdk11 \
&& /usr/lib/jvm/java-11-openjdk/bin/jlink --add-modules java.rmi,java.management.rmi,jdk.unsupported --verbose --strip-debug --compress 2 \
--no-header-files --no-man-pages --output /jdk
###########################################
### Container Stage ###
###########################################
FROM alpine:latest
COPY ./resources/trust/store.p12 /opt/store.p12
COPY ./resources/scripts/start.sh /opt/start.sh
COPY ./resources/conf/policy /opt/policy
COPY --from=maven-builder /usr/src/app/target/rmg-example-server-*-jar-with-dependencies.jar /opt/example-server.jar
COPY --from=jdk-builder /jdk /usr/lib/jvm/java-11-openjdk
RUN set -ex \
&& ln -s /usr/lib/jvm/java-11-openjdk/bin/java /usr/bin/java \
&& chmod +x /opt/start.sh
ENV _JAVA_OPTIONS -Djava.rmi.server.hostname=iinsecure.example \
-Djavax.net.ssl.keyStorePassword=password \
-Djavax.net.ssl.keyStore=/opt/store.p12 \
-Djavax.net.ssl.keyStoreType=pkcs12 \
-Djava.rmi.server.useCodebaseOnly=false \
-Djava.security.policy=/opt/policy \
-Djava.rmi.server.codebase=http://iinsecure.example/well-hidden-development-folder/
EXPOSE 1090/tcp 1098/tcp 9010/tcp
CMD ["/opt/start.sh"]