diff --git a/Dockerfile b/Dockerfile index 9743ead..26cb468 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,30 +1,35 @@ -FROM alpine:3.14 +FROM bitnami/minideb:latest -ARG GRAALVERSION +LABEL maintainer="Uzurka " -COPY platform.sh ./platform.sh -RUN ls -l -RUN chmod +x ./platform.sh && ./platform.sh +ARG JAVA_VERSION="20.0.2-graal" -RUN apk update && apk upgrade && \ - apk add --no-cache curl ca-certificates bash tzdata fontconfig zip sed +ENV SDKMAN_DIR=/root/.sdkman -SHELL ["/bin/bash", "-c"] +COPY entrypoint.sh /root -RUN curl -s "https://get.sdkman.io" | bash && \ - source "/root/.sdkman/bin/sdkman-init.sh" && \ - sdk install java $GRAALVERSION && \ - sdk flush +RUN apt-get update \ + && apt-get install -y --no-install-recommends curl zip unzip ca-certificates locales \ + && echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \ + && locale-gen en_US.UTF-8 \ + && apt-get -y autoremove \ + && rm -rf /var/lib/apt/lists/* \ + && curl 'https://get.sdkman.io' | bash \ + && echo "sdkman_auto_answer=true" > "${SDKMAN_DIR}"/etc/config \ + && echo "sdkman_auto_selfupdate=false" >> "${SDKMAN_DIR}"/etc/config \ + && echo "sdkman_insecure_ssl=true" >> "${SDKMAN_DIR}"/etc/config \ + && chmod +x "${SDKMAN_DIR}"/bin/sdkman-init.sh \ + && chmod +x /root/entrypoint.sh -ENV LANG C.UTF-8 +RUN bash -c "source "${SDKMAN_DIR}"/bin/sdkman-init.sh \ + && sdk version \ + && sdk install java "${JAVA_VERSION}" \ + && gu install js \ + && rm -rf "${SDKMAN_DIR}"/archives/* \ + && rm -rf "${SDKMAN_DIR}"/tmp/*" -RUN adduser -D -h /home/container -s /bin/bash container -USER container -WORKDIR /home/container +WORKDIR /opt/app -COPY _docker-java-home /usr/local/bin/docker-java-home -COPY _bashrc /home/container/.bashrc -COPY _entrypoint.sh /entrypoint.sh +SHELL ["/bin/bash", "-i", "-c"] -# Commande d'entrée -CMD ["/bin/bash", "/entrypoint.sh"] \ No newline at end of file +ENTRYPOINT [ "/root/entrypoint.sh" ] \ No newline at end of file diff --git a/Dockerfile_debian b/Dockerfile_debian deleted file mode 100644 index f004413..0000000 --- a/Dockerfile_debian +++ /dev/null @@ -1,127 +0,0 @@ -# ---------------------------------- -# 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 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 - -COPY platform.sh . -RUN chmod +x ./platform.sh \ - && ./platform.sh - -SHELL ["/bin/bash", "-c"] - -LABEL org.opencontainers.image.title "GraalVM Enterprise Edition" -LABEL org.opencontainers.image.authors "GraalVM Sustaining Team " -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"] \ No newline at end of file diff --git a/_bashrc b/_bashrc deleted file mode 100644 index 706a826..0000000 --- a/_bashrc +++ /dev/null @@ -1,13 +0,0 @@ -# 2023-08-09 - -export PS1='\n\[\e[32m\]\u@\h: \[\e[33m\]\w\[\e[0m\]\n> ' -export BASH=/bin/bash -export SHELL=$BASH - -export LS_OPTIONS='--color=auto' -alias ls='ls $LS_OPTIONS' -alias ll='ls $LS_OPTIONS -l' -alias la='ls $LS_OPTIONS -la' - -export JAVA_HOME=/opt/graalvm -export PATH=$JAVA_HOME/bin:$PATH diff --git a/_docker-java-home b/_docker-java-home deleted file mode 100644 index 12163bf..0000000 --- a/_docker-java-home +++ /dev/null @@ -1,3 +0,0 @@ -#/bin/sh -# 2023-08-09 -echo $JAVA_HOME diff --git a/_entrypoint.sh b/_entrypoint.sh deleted file mode 100644 index a65a0a0..0000000 --- a/_entrypoint.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# 2023-08-09 - -# -# 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. -# - -# Default the TZ environment variable to UTC. -TZ=${TZ:-UTC} -export TZ - -# Set environment variable that holds the Internal Docker IP -INTERNAL_IP=$(ip route get 1 | awk '{print $NF;exit}') -export INTERNAL_IP - -# Switch to the container's working directory -cd /home/container || exit 1 - -# Display Specifics -printf ">>> [ GraalVM AMD64 Image ] <<<\n" - -# Print Java version -printf "\033[1m\033[33mcontainer@pterodactyl~ \033[0mjava -version\n" -java -version - -# Convert all of the "{{VARIABLE}}" parts of the command into the expected shell -# variable format of "${VARIABLE}" before evaluating the string and automatically -# replacing the values. -PARSED=$(echo "${STARTUP}" | sed -e 's/{{/${/g' -e 's/}}/}/g' | eval echo "$(cat -)") - -# Display the command we're running in the output, and then execute it with the env -# from the container itself. -printf "\033[1m\033[33mcontainer@pterodactyl~ \033[0m%s\n" "$PARSED" - -# shellcheck disable=SC2086 -exec env ${PARSED} diff --git a/build.sh b/build.sh deleted file mode 100644 index 3836927..0000000 --- a/build.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash -# 2023-08-09 -# ---------------------------------- -# Pterodactyl Core Dockerfile Builder -# Environment: Java / GraalVM -# Minimum Panel Version: 1.7.0 -# ---------------------------------- - -clear -cd "$(dirname "$0")" || exit 1 - -# Define what version of GraalVM -GRAALVM_YEAR_VERSION=20 -GRAALVM_MAJOR_VERSION=0 -GRAALVM_MINOR_VERSION=2 -JAVA_VERSION=20 -JAVA_HOME=/opt/graalvm - -# Setup for SDKMAN! -GRAALVERSION=$GRAALVM_YEAR_VERSION.$GRAALVM_MAJOR_VERSION.$GRAALVM_MINOR_VERSION-graal -SDKMAN=/root/.sdkman - -# Docker image name and version -IMAGE_BASE=zogg/graalvm -IMAGE_NAME_LATEST=${IMAGE_BASE}:latest - -# Update GraalVM version in relevant files -find="GRAALVERSION" -replace="$GRAALVERSION" -sed "s/${find}/${replace}/g" files/_bashrc > files/bashrc -sed "s/${find}/${replace}/g" files/_docker-java-home > files/docker-java-home -sed "s/${find}/${replace}/g" files/_entrypoint.sh > files/entrypoint.sh - -# Prepare for cross compile -export DOCKER_DEFAULT_PLATFORM=linux/amd64 -export DOCKER_CLI_EXPERIMENTAL=enabled -docker run --privileged --rm tonistiigi/binfmt --install all - -# Build with no caching disabled -docker buildx build --pull --no-cache \ - --platform=linux/amd64 \ - --output=type=docker \ - --build-arg TZ=Europe/Paris \ - --build-arg CONCURRENCY=$(nproc) \ - --build-arg GRAALVERSION=${GRAALVERSION} \ - --build-arg SDKMAN=${SDKMAN} \ - --build-arg GRAALVM_YEAR_VERSION=${GRAALVM_YEAR_VERSION} \ - --build-arg GRAALVM_MAJOR_VERSION=${GRAALVM_MAJOR_VERSION} \ - --build-arg GRAALVM_MINOR_VERSION=${GRAALVM_MINOR_VERSION} \ - --build-arg JAVA_VERSION=${JAVA_VERSION} \ - --build-arg JAVA_HOME=${JAVA_HOME} \ - -t "${IMAGE_NAME_LATEST}" \ - . 2>&1 | tee build.log - -exit 0 diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..032c6a7 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +source /root/.bashrc && "$@" \ No newline at end of file diff --git a/platform.sh b/platform.sh deleted file mode 100644 index d2dfefa..0000000 --- a/platform.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -# Used in Docker build to set platform dependent variables - -case $TARGETARCH in - - "amd64") - echo "x86_64-unknown-linux-gnu" > /.platform - echo "" > /.compiler - ;; - "arm64") - echo "aarch64-unknown-linux-gnu" > /.platform - echo "gcc-aarch64-linux-gnu" > /.compiler - ;; - "arm") - echo "armv7-unknown-linux-gnueabihf" > /.platform - echo "gcc-arm-linux-gnueabihf" > /.compiler - ;; -esac