-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
41 lines (35 loc) · 1.54 KB
/
Dockerfile
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
FROM eclipse-temurin:17-jdk-alpine as jre-build
# Create a custom Java runtime
# https://github.com/adoptium/containers/issues/80
# java.desktop: For java/beans/PropertyEditorSupport -> Spring-Context
# java.logging: For java/util/logging/Logger -> org.yaml.snakeyaml.TypeDescription
# java.sql: For java/sql/DataSource -> database
# java.naming: For javax.naming.NamingException -> DataSourceBuilder$HikariDataSourceProperties
# java.management: For javax.management.NotificationEmitter
# java.instrument: For java.lang.instrument.ClassFileTransformer -> PersistenceUnit something
# jdk.unsupported: For Objenesis when there is no default constructor https://github.com/easymock/objenesis/issues/70
RUN $JAVA_HOME/bin/jlink \
--add-modules java.base \
--add-modules java.desktop \
--add-modules java.logging \
--add-modules java.sql \
--add-modules java.naming \
--add-modules java.management \
--add-modules java.instrument \
--add-modules jdk.unsupported \
--strip-java-debug-attributes \
--no-man-pages \
--no-header-files \
--compress=2 \
--output /javaruntime
FROM gradle:7.2-jdk17 AS build
COPY . .
RUN gradle build
FROM alpine:3 AS run
ENV JAVA_HOME=/opt/java/openjdk
ENV PATH "${JAVA_HOME}/bin:${PATH}"
COPY --from=jre-build /javaruntime $JAVA_HOME
COPY --from=build /home/gradle/build/libs/sic.jar /sic.jar
EXPOSE 8080
ENTRYPOINT ["/opt/java/openjdk/bin/java", "-jar"]
CMD ["-XX:+UseContainerSupport", "-XX:MaxRAMPercentage=80.0", "/sic.jar"]