Files
GraalVM/Dockerfile
uzurka c1ff540cc1
Some checks failed
continuous-integration/drone/push Build is failing
fixed Dockerfile
2023-08-13 18:55:00 +02:00

130 lines
5.1 KiB
Docker

# ----------------------------------
# Pterodactyl Core Dockerfile
# Environment: Java
# Minimum Panel Version: 1.7.0
# ----------------------------------
# Copyright (c) 2021 Matthew Penner
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# ----------------------------------
# 2023-08-09
FROM --platform=linux/amd64 debian:stable-slim
ARG TARGETPLATFORM
ARG TARGETOS
ARG TARGETARCH
ARG BUILDPLATFORM
ARG BUILDOS
ARG BUILDARCH
ARG BUILDVARIANT
ARG GRAALVERSION
ARG SDKMAN
ARG GRAALVM_YEAR_VERSION
ARG GRAALVM_MAJOR_VERSION
ARG GRAALVM_MINOR_VERSION
ARG JAVA_VERSION
ARG JAVA_HOME
RUN mkdir /scripts
COPY platform.sh /scripts/platform.sh
RUN ls -l /scripts
RUN chmod +x /scripts/platform.sh
RUN ["/bin/bash", "-c", "/scripts/platform.sh"]
SHELL ["/bin/bash", "-c"]
LABEL org.opencontainers.image.title "GraalVM Enterprise Edition"
LABEL org.opencontainers.image.authors "GraalVM Sustaining Team <graalvm-sustaining_ww_grp@oracle.com>"
LABEL org.opencontainers.image.description "GraalVM is a universal virtual machine for running applications written in JavaScript, Python, Ruby, R, JVM-based languages like Java, Scala, Clojure, Kotlin, and LLVM-based languages such as C and C++."
LABEL com.centurylinklabs.watchtower.enable false
LABEL org.opencontainers.image.licenses MIT
LABEL author "Olivier Le Bris"
LABEL maintainer "tech@zogg.fr"
LABEL org.opencontainers.image.source "https://zogg.fr"
ENV GRAALVERSION $GRAALVERSION
ENV LANG C.UTF-8
ENV GRAALVM_YEAR_VERSION $GRAALVM_YEAR_VERSION
ENV GRAALVM_MAJOR_VERSION $GRAALVM_MAJOR_VERSION
ENV GRAALVM_MINOR_VERSION $GRAALVM_MINOR_VERSION
ENV JAVA_VERSION $JAVA_VERSION
ENV JAVA_HOME $JAVA_HOME
ENV PATH $JAVA_HOME/bin:${PATH}
USER root
WORKDIR /
# Install neccessary packages
RUN set -eux \
&& apt update \
&& apt full-upgrade -y \
&& apt install curl ca-certificates p11-kit openssl tar sqlite3 fontconfig tzdata iproute2 libstdc++-11-dev bash wget zip unzip -y \
&& apt autoremove -y
# Setup 'container' user and group (with home folder)
RUN useradd -d /home/container -m container -s /bin/bash -p 'none' \
&& passwd -d container
# Install SDKMAN! and GraalVM specified version
RUN curl -s "https://get.sdkman.io" | bash \
&& source "$SDKMAN/bin/sdkman-init.sh" \
&& sdk install java $GRAALVERSION
# Copy GraalVM files to destination folder
RUN mkdir -p /opt/graalvm \
&& cp -rf $SDKMAN/candidates/java/$GRAALVERSION/. /opt/graalvm/ \
&& chown -R container:container /opt/graalvm
# Setup GraalVM as default Java interpreter
USER root
WORKDIR /app
RUN mkdir -p /usr/java \
&& ln -sf /opt/graalvm /usr/java/default \
&& ln -sf /opt/graalvm /usr/java/latest \
&& for bin in "/opt/graalvm/bin/"*; do base="$(basename "$bin")"; \
[ ! -e "/usr/bin/$base" ]; \
update-alternatives --install "/usr/bin/$base" "$base" "$bin" 20000; \
done
# Uninstall SDKMAN! and do some cleanup
USER root
WORKDIR /
RUN source "$SDKMAN/bin/sdkman-init.sh" \
&& sdk uninstall java $GRAALVERSION --force \
&& sdk flush \
&& rm -rf $SDKMAN \
&& apt autoremove -y
# Setup Pterodactyl necessary context
USER container
WORKDIR /home/container
ENV USER container
ENV HOME /home/container
COPY _docker-java-home /usr/local/bin/docker-java-home
COPY _bashrc /home/container/.bashrc
COPY _entrypoint.sh /entrypoint.sh
# Run Pterodactyl entrypoint
CMD ["/bin/bash", "/entrypoint.sh"]