-
Notifications
You must be signed in to change notification settings - Fork 17
/
Dockerfile
32 lines (23 loc) · 1011 Bytes
/
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
# Example of custom Java runtime using jlink in a multi-stage container build
FROM container-registry.oracle.com/java/openjdk:21-oraclelinux8 as jre-build
# Create a custom Java runtime
RUN $JAVA_HOME/bin/jlink \
--add-modules java.base,java.compiler,java.desktop,java.instrument,java.net.http,java.prefs,java.rmi,java.scripting,java.security.jgss,java.sql.rowset,jdk.jfr,jdk.management,jdk.management.agent,jdk.management.jfr,jdk.jcmd,jdk.net,jdk.unsupported \
--no-man-pages \
--no-header-files \
--compress=zip-9 \
--output /javaruntime
# Define your base image
FROM oraclelinux:8-slim
ENV JAVA_HOME /usr/java/openjdk-21
ENV PATH $JAVA_HOME/bin:$PATH
COPY --from=jre-build /javaruntime $JAVA_HOME
# Continue with your application deployment
COPY ./target/spring-todo-app.jar /app.jar
COPY entrypoint.sh /entrypoint.sh
RUN groupadd -r appuser && useradd -r -g appuser appuser
RUN chmod +x /entrypoint.sh
USER appuser
EXPOSE 1099
ENV JDK_JAVA_OPTIONS "--enable-preview"
CMD ["/entrypoint.sh"]