1616#
1717# You should have received a copy of the GNU General Public License
1818# along with this program. If not, see <http://www.gnu.org/licenses/>.
19+ FROM docker.io/eclipse-temurin:21-jdk-noble@sha256:5d935f3e86b5b629fc8994503e89b73137b24048a5b465fbaa605de80c678b54 AS jre-build
1920
20- # TODO: what about an alpine variant?
21- FROM docker.io/ubuntu:noble@sha256:72297848456d5d37d1262630108ab308d3e9ec7ed1c3286a32fe09856619a782 AS build
21+ # Create a custom Java runtime
22+ #
23+ # All modules are included (ALL-MODULE-PATH) since we are unable to know which ones
24+ # are required by plugins
25+ RUN ${JAVA_HOME}/bin/jlink \
26+ --add-modules ALL-MODULE-PATH \
27+ --strip-debug \
28+ --no-man-pages \
29+ --no-header-files \
30+ --output /jre
31+
32+ FROM docker.io/ubuntu:noble@sha256:72297848456d5d37d1262630108ab308d3e9ec7ed1c3286a32fe09856619a782 AS papermc-server-build
2233
2334ARG MINECRAFT_VERSION
2435
@@ -41,7 +52,14 @@ RUN apt-get update && \
4152COPY --chmod=500 get-papermc-server.sh .
4253RUN ./get-papermc-server.sh "$MINECRAFT_VERSION"
4354
44- FROM docker.io/eclipse-temurin:21-jre-noble@sha256:3ef64ec531571987f58ccc90bd3d7f92950539f1baa00a5c45b660d6faccf37d
55+ # TODO: what about an alpine variant?
56+ FROM docker.io/ubuntu:noble@sha256:72297848456d5d37d1262630108ab308d3e9ec7ed1c3286a32fe09856619a782
57+
58+ # JRE setup
59+ ENV JAVA_HOME=/opt/java
60+ ENV PATH="${JAVA_HOME}/bin:${PATH}"
61+
62+ COPY --from=jre-build /jre ${JAVA_HOME}
4563
4664# Need to be turned to "true" manually to confirm agreement with Minecraft EULA (https://aka.ms/MinecraftEULA)
4765ENV EULA=false
@@ -68,7 +86,7 @@ WORKDIR /home/papermc
6886ADD --chmod=444 https://raw.githubusercontent.com/Djaytan/docker-papermc-server/refs/heads/main/LICENSE.md .
6987
7088# Copy the PaperMC server
71- COPY --from=build --chown=papermc --chmod=500 /build/papermc-server-*.jar ./
89+ COPY --from=papermc-server- build --chown=papermc --chmod=500 /build/papermc-server-*.jar ./
7290
7391# Copy the configuration files
7492# Write access is required by PaperMC to update the configuration files
0 commit comments