mirror of
https://github.com/darksaid98/pterodactyl-graalvm.git
synced 2026-12-04 16:48:45 +00:00
add git support in entrypoint.sh
This commit is contained in:
11 files changed
+380
-54
No files matched your search
@@ -44,7 +44,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
# list of Docker images to use as base name for tags
|
# list of Docker images to use as base name for tags
|
||||||
images: |
|
images: |
|
||||||
ghcr.io/rikodev/pterodactyl-graalvm
|
ghcr.io/darksaid98/pterodactyl-graalvm
|
||||||
# generate Docker tags based on the following events/attributes
|
# generate Docker tags based on the following events/attributes
|
||||||
tags: |
|
tags: |
|
||||||
type=raw,${{ matrix.tag }}
|
type=raw,${{ matrix.tag }}
|
||||||
|
|||||||
+2
-2
@@ -9,9 +9,9 @@ ARG TARGETPLATFORM
|
|||||||
ARG GRAAL_VERSION=22.3.2
|
ARG GRAAL_VERSION=22.3.2
|
||||||
ARG JAVA_VERSION=11
|
ARG JAVA_VERSION=11
|
||||||
|
|
||||||
LABEL author="RikoDEV" maintainer="[email protected]"
|
LABEL author="darksaid98" maintainer="[email protected]"
|
||||||
|
|
||||||
LABEL org.opencontainers.image.source="https://github.com/RikoDEV/pterodactyl-graalvm"
|
LABEL org.opencontainers.image.source="https://github.com/darksaid98/pterodactyl-graalvm"
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
|||||||
+75
-8
@@ -1,12 +1,79 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
cd /home/container
|
|
||||||
|
|
||||||
# Output Current Java Version
|
# Default the TZ environment variable to UTC.
|
||||||
java -version ## only really needed to show what version is being used. Should be changed for different applications
|
TZ=${TZ:-UTC}
|
||||||
|
export TZ
|
||||||
|
|
||||||
# Replace Startup Variables
|
# Set environment variable that holds the Internal Docker IP
|
||||||
MODIFIED_STARTUP=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')`
|
INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}')
|
||||||
echo ":/home/container$ ${MODIFIED_STARTUP}"
|
export INTERNAL_IP
|
||||||
|
|
||||||
# Run the Server
|
# Switch to the container's working directory
|
||||||
${MODIFIED_STARTUP}
|
cd /home/container || exit 1
|
||||||
|
|
||||||
|
# Update repo from git
|
||||||
|
if [ "${USER_UPLOAD}" == "false" ] || [ "${USER_UPLOAD}" == "0" ]; then
|
||||||
|
echo -e "Git enabled."
|
||||||
|
|
||||||
|
## add git ending if it's not on the address
|
||||||
|
if [[ ${GIT_ADDRESS} != *.git ]]; then
|
||||||
|
GIT_ADDRESS=${GIT_ADDRESS}.git
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${USERNAME}" ] && [ -z "${ACCESS_TOKEN}" ]; then
|
||||||
|
echo -e "Git Username or Git Token was not specified. Proceeding anonymously."
|
||||||
|
else
|
||||||
|
GIT_ADDRESS="https://${USERNAME}:${ACCESS_TOKEN}@$(echo -e ${GIT_ADDRESS} | cut -d/ -f3-)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$(ls -A /home/container)" ]; then
|
||||||
|
echo -e "/home/container directory is not empty."
|
||||||
|
|
||||||
|
# Get git origin from /home/container/.git/config
|
||||||
|
if [ -d .git ]; then
|
||||||
|
echo -e ".git directory exists"
|
||||||
|
if [ -f .git/config ]; then
|
||||||
|
echo -e "loading info from git config"
|
||||||
|
ORIGIN=$(git config --get remote.origin.url)
|
||||||
|
else
|
||||||
|
echo -e "files found with no git config"
|
||||||
|
echo -e "closing out without touching things to not break anything"
|
||||||
|
exit 10
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If git origin matches the repo specified by user then pull
|
||||||
|
if [ "${ORIGIN}" == "${GIT_ADDRESS}" ]; then
|
||||||
|
echo "pulling latest from github"
|
||||||
|
git pull && echo "Finished pulling /home/container from Git." || echo "Failed pulling /home/container from Git."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# No files exist in resources folder, clone
|
||||||
|
echo -e "/home/container is empty.\ncloning files into repo"
|
||||||
|
if [ -z ${BRANCH} ]; then
|
||||||
|
echo -e "Cloning default branch into /home/container."
|
||||||
|
git clone ${GIT_ADDRESS} .
|
||||||
|
else
|
||||||
|
echo -e "Cloning ${BRANCH} branch into /home/container."
|
||||||
|
git clone --single-branch --branch ${BRANCH} ${GIT_ADDRESS} . && echo "Finished cloning into /home/container from Git." || echo "Failed cloning into /home/container from Git."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -e "Git disabled."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 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}
|
||||||
+2
-2
@@ -9,9 +9,9 @@ ARG TARGETPLATFORM
|
|||||||
ARG GRAAL_VERSION=22.3.2
|
ARG GRAAL_VERSION=22.3.2
|
||||||
ARG JAVA_VERSION=11
|
ARG JAVA_VERSION=11
|
||||||
|
|
||||||
LABEL author="RikoDEV" maintainer="[email protected]"
|
LABEL author="darksaid98" maintainer="[email protected]"
|
||||||
|
|
||||||
LABEL org.opencontainers.image.source="https://github.com/RikoDEV/pterodactyl-graalvm"
|
LABEL org.opencontainers.image.source="https://github.com/darksaid98/pterodactyl-graalvm"
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
|||||||
+75
-8
@@ -1,12 +1,79 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
cd /home/container
|
|
||||||
|
|
||||||
# Output Current Java Version
|
# Default the TZ environment variable to UTC.
|
||||||
java -version ## only really needed to show what version is being used. Should be changed for different applications
|
TZ=${TZ:-UTC}
|
||||||
|
export TZ
|
||||||
|
|
||||||
# Replace Startup Variables
|
# Set environment variable that holds the Internal Docker IP
|
||||||
MODIFIED_STARTUP=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')`
|
INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}')
|
||||||
echo ":/home/container$ ${MODIFIED_STARTUP}"
|
export INTERNAL_IP
|
||||||
|
|
||||||
# Run the Server
|
# Switch to the container's working directory
|
||||||
${MODIFIED_STARTUP}
|
cd /home/container || exit 1
|
||||||
|
|
||||||
|
# Update repo from git
|
||||||
|
if [ "${USER_UPLOAD}" == "false" ] || [ "${USER_UPLOAD}" == "0" ]; then
|
||||||
|
echo -e "Git enabled."
|
||||||
|
|
||||||
|
## add git ending if it's not on the address
|
||||||
|
if [[ ${GIT_ADDRESS} != *.git ]]; then
|
||||||
|
GIT_ADDRESS=${GIT_ADDRESS}.git
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${USERNAME}" ] && [ -z "${ACCESS_TOKEN}" ]; then
|
||||||
|
echo -e "Git Username or Git Token was not specified. Proceeding anonymously."
|
||||||
|
else
|
||||||
|
GIT_ADDRESS="https://${USERNAME}:${ACCESS_TOKEN}@$(echo -e ${GIT_ADDRESS} | cut -d/ -f3-)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$(ls -A /home/container)" ]; then
|
||||||
|
echo -e "/home/container directory is not empty."
|
||||||
|
|
||||||
|
# Get git origin from /home/container/.git/config
|
||||||
|
if [ -d .git ]; then
|
||||||
|
echo -e ".git directory exists"
|
||||||
|
if [ -f .git/config ]; then
|
||||||
|
echo -e "loading info from git config"
|
||||||
|
ORIGIN=$(git config --get remote.origin.url)
|
||||||
|
else
|
||||||
|
echo -e "files found with no git config"
|
||||||
|
echo -e "closing out without touching things to not break anything"
|
||||||
|
exit 10
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If git origin matches the repo specified by user then pull
|
||||||
|
if [ "${ORIGIN}" == "${GIT_ADDRESS}" ]; then
|
||||||
|
echo "pulling latest from github"
|
||||||
|
git pull && echo "Finished pulling /home/container from Git." || echo "Failed pulling /home/container from Git."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# No files exist in resources folder, clone
|
||||||
|
echo -e "/home/container is empty.\ncloning files into repo"
|
||||||
|
if [ -z ${BRANCH} ]; then
|
||||||
|
echo -e "Cloning default branch into /home/container."
|
||||||
|
git clone ${GIT_ADDRESS} .
|
||||||
|
else
|
||||||
|
echo -e "Cloning ${BRANCH} branch into /home/container."
|
||||||
|
git clone --single-branch --branch ${BRANCH} ${GIT_ADDRESS} . && echo "Finished cloning into /home/container from Git." || echo "Failed cloning into /home/container from Git."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -e "Git disabled."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 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}
|
||||||
+2
-2
@@ -9,9 +9,9 @@ ARG TARGETPLATFORM
|
|||||||
ARG GRAAL_VERSION=22.3.2
|
ARG GRAAL_VERSION=22.3.2
|
||||||
ARG JAVA_VERSION=17
|
ARG JAVA_VERSION=17
|
||||||
|
|
||||||
LABEL author="RikoDEV" maintainer="[email protected]"
|
LABEL author="darksaid98" maintainer="[email protected]"
|
||||||
|
|
||||||
LABEL org.opencontainers.image.source="https://github.com/RikoDEV/pterodactyl-graalvm"
|
LABEL org.opencontainers.image.source="https://github.com/darksaid98/pterodactyl-graalvm"
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
|||||||
+73
-9
@@ -1,15 +1,79 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
cd /home/container
|
|
||||||
|
# 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-2);exit}')
|
||||||
|
export INTERNAL_IP
|
||||||
|
|
||||||
|
# Switch to the container's working directory
|
||||||
|
cd /home/container || exit 1
|
||||||
|
|
||||||
|
# Update repo from git
|
||||||
|
if [ "${USER_UPLOAD}" == "false" ] || [ "${USER_UPLOAD}" == "0" ]; then
|
||||||
|
echo -e "Git enabled."
|
||||||
|
|
||||||
|
## add git ending if it's not on the address
|
||||||
|
if [[ ${GIT_ADDRESS} != *.git ]]; then
|
||||||
|
GIT_ADDRESS=${GIT_ADDRESS}.git
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${USERNAME}" ] && [ -z "${ACCESS_TOKEN}" ]; then
|
||||||
|
echo -e "Git Username or Git Token was not specified. Proceeding anonymously."
|
||||||
|
else
|
||||||
|
GIT_ADDRESS="https://${USERNAME}:${ACCESS_TOKEN}@$(echo -e ${GIT_ADDRESS} | cut -d/ -f3-)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$(ls -A /home/container)" ]; then
|
||||||
|
echo -e "/home/container directory is not empty."
|
||||||
|
|
||||||
|
# Get git origin from /home/container/.git/config
|
||||||
|
if [ -d .git ]; then
|
||||||
|
echo -e ".git directory exists"
|
||||||
|
if [ -f .git/config ]; then
|
||||||
|
echo -e "loading info from git config"
|
||||||
|
ORIGIN=$(git config --get remote.origin.url)
|
||||||
|
else
|
||||||
|
echo -e "files found with no git config"
|
||||||
|
echo -e "closing out without touching things to not break anything"
|
||||||
|
exit 10
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If git origin matches the repo specified by user then pull
|
||||||
|
if [ "${ORIGIN}" == "${GIT_ADDRESS}" ]; then
|
||||||
|
echo "pulling latest from github"
|
||||||
|
git pull && echo "Finished pulling /home/container from Git." || echo "Failed pulling /home/container from Git."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# No files exist in resources folder, clone
|
||||||
|
echo -e "/home/container is empty.\ncloning files into repo"
|
||||||
|
if [ -z ${BRANCH} ]; then
|
||||||
|
echo -e "Cloning default branch into /home/container."
|
||||||
|
git clone ${GIT_ADDRESS} .
|
||||||
|
else
|
||||||
|
echo -e "Cloning ${BRANCH} branch into /home/container."
|
||||||
|
git clone --single-branch --branch ${BRANCH} ${GIT_ADDRESS} . && echo "Finished cloning into /home/container from Git." || echo "Failed cloning into /home/container from Git."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -e "Git disabled."
|
||||||
|
fi
|
||||||
|
|
||||||
# Print Java version
|
# Print Java version
|
||||||
|
printf "\033[1m\033[33mcontainer@pterodactyl~ \033[0mjava -version\n"
|
||||||
java -version
|
java -version
|
||||||
|
|
||||||
# Make internal Docker IP address available to processes.
|
# Convert all of the "{{VARIABLE}}" parts of the command into the expected shell
|
||||||
export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'`
|
# 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 -)")
|
||||||
|
|
||||||
# Replace Startup Variables
|
# Display the command we're running in the output, and then execute it with the env
|
||||||
MODIFIED_STARTUP=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')`
|
# from the container itself.
|
||||||
echo ":/home/container$ ${MODIFIED_STARTUP}"
|
printf "\033[1m\033[33mcontainer@pterodactyl~ \033[0m%s\n" "$PARSED"
|
||||||
|
# shellcheck disable=SC2086
|
||||||
# Run the Server
|
exec env ${PARSED}
|
||||||
eval ${MODIFIED_STARTUP}
|
|
||||||
+2
-2
@@ -9,9 +9,9 @@ ARG TARGETPLATFORM
|
|||||||
ARG GRAAL_VERSION=22.3.2
|
ARG GRAAL_VERSION=22.3.2
|
||||||
ARG JAVA_VERSION=17
|
ARG JAVA_VERSION=17
|
||||||
|
|
||||||
LABEL author="RikoDEV" maintainer="[email protected]"
|
LABEL author="darksaid98" maintainer="[email protected]"
|
||||||
|
|
||||||
LABEL org.opencontainers.image.source="https://github.com/RikoDEV/pterodactyl-graalvm"
|
LABEL org.opencontainers.image.source="https://github.com/darksaid98/pterodactyl-graalvm"
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
|||||||
+73
-9
@@ -1,15 +1,79 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
cd /home/container
|
|
||||||
|
# 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-2);exit}')
|
||||||
|
export INTERNAL_IP
|
||||||
|
|
||||||
|
# Switch to the container's working directory
|
||||||
|
cd /home/container || exit 1
|
||||||
|
|
||||||
|
# Update repo from git
|
||||||
|
if [ "${USER_UPLOAD}" == "false" ] || [ "${USER_UPLOAD}" == "0" ]; then
|
||||||
|
echo -e "Git enabled."
|
||||||
|
|
||||||
|
## add git ending if it's not on the address
|
||||||
|
if [[ ${GIT_ADDRESS} != *.git ]]; then
|
||||||
|
GIT_ADDRESS=${GIT_ADDRESS}.git
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${USERNAME}" ] && [ -z "${ACCESS_TOKEN}" ]; then
|
||||||
|
echo -e "Git Username or Git Token was not specified. Proceeding anonymously."
|
||||||
|
else
|
||||||
|
GIT_ADDRESS="https://${USERNAME}:${ACCESS_TOKEN}@$(echo -e ${GIT_ADDRESS} | cut -d/ -f3-)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$(ls -A /home/container)" ]; then
|
||||||
|
echo -e "/home/container directory is not empty."
|
||||||
|
|
||||||
|
# Get git origin from /home/container/.git/config
|
||||||
|
if [ -d .git ]; then
|
||||||
|
echo -e ".git directory exists"
|
||||||
|
if [ -f .git/config ]; then
|
||||||
|
echo -e "loading info from git config"
|
||||||
|
ORIGIN=$(git config --get remote.origin.url)
|
||||||
|
else
|
||||||
|
echo -e "files found with no git config"
|
||||||
|
echo -e "closing out without touching things to not break anything"
|
||||||
|
exit 10
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If git origin matches the repo specified by user then pull
|
||||||
|
if [ "${ORIGIN}" == "${GIT_ADDRESS}" ]; then
|
||||||
|
echo "pulling latest from github"
|
||||||
|
git pull && echo "Finished pulling /home/container from Git." || echo "Failed pulling /home/container from Git."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# No files exist in resources folder, clone
|
||||||
|
echo -e "/home/container is empty.\ncloning files into repo"
|
||||||
|
if [ -z ${BRANCH} ]; then
|
||||||
|
echo -e "Cloning default branch into /home/container."
|
||||||
|
git clone ${GIT_ADDRESS} .
|
||||||
|
else
|
||||||
|
echo -e "Cloning ${BRANCH} branch into /home/container."
|
||||||
|
git clone --single-branch --branch ${BRANCH} ${GIT_ADDRESS} . && echo "Finished cloning into /home/container from Git." || echo "Failed cloning into /home/container from Git."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -e "Git disabled."
|
||||||
|
fi
|
||||||
|
|
||||||
# Print Java version
|
# Print Java version
|
||||||
|
printf "\033[1m\033[33mcontainer@pterodactyl~ \033[0mjava -version\n"
|
||||||
java -version
|
java -version
|
||||||
|
|
||||||
# Make internal Docker IP address available to processes.
|
# Convert all of the "{{VARIABLE}}" parts of the command into the expected shell
|
||||||
export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'`
|
# 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 -)")
|
||||||
|
|
||||||
# Replace Startup Variables
|
# Display the command we're running in the output, and then execute it with the env
|
||||||
MODIFIED_STARTUP=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')`
|
# from the container itself.
|
||||||
echo ":/home/container$ ${MODIFIED_STARTUP}"
|
printf "\033[1m\033[33mcontainer@pterodactyl~ \033[0m%s\n" "$PARSED"
|
||||||
|
# shellcheck disable=SC2086
|
||||||
# Run the Server
|
exec env ${PARSED}
|
||||||
eval ${MODIFIED_STARTUP}
|
|
||||||
+2
-2
@@ -9,9 +9,9 @@ ARG TARGETPLATFORM
|
|||||||
ARG GRAAL_VERSION=22.3.1
|
ARG GRAAL_VERSION=22.3.1
|
||||||
ARG JAVA_VERSION=19
|
ARG JAVA_VERSION=19
|
||||||
|
|
||||||
LABEL author="RikoDEV" maintainer="[email protected]"
|
LABEL author="darksaid98" maintainer="[email protected]"
|
||||||
|
|
||||||
LABEL org.opencontainers.image.source="https://github.com/RikoDEV/pterodactyl-graalvm"
|
LABEL org.opencontainers.image.source="https://github.com/darksaid98/pterodactyl-graalvm"
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
|||||||
+73
-9
@@ -1,15 +1,79 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
cd /home/container
|
|
||||||
|
# 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-2);exit}')
|
||||||
|
export INTERNAL_IP
|
||||||
|
|
||||||
|
# Switch to the container's working directory
|
||||||
|
cd /home/container || exit 1
|
||||||
|
|
||||||
|
# Update repo from git
|
||||||
|
if [ "${USER_UPLOAD}" == "false" ] || [ "${USER_UPLOAD}" == "0" ]; then
|
||||||
|
echo -e "Git enabled."
|
||||||
|
|
||||||
|
## add git ending if it's not on the address
|
||||||
|
if [[ ${GIT_ADDRESS} != *.git ]]; then
|
||||||
|
GIT_ADDRESS=${GIT_ADDRESS}.git
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${USERNAME}" ] && [ -z "${ACCESS_TOKEN}" ]; then
|
||||||
|
echo -e "Git Username or Git Token was not specified. Proceeding anonymously."
|
||||||
|
else
|
||||||
|
GIT_ADDRESS="https://${USERNAME}:${ACCESS_TOKEN}@$(echo -e ${GIT_ADDRESS} | cut -d/ -f3-)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$(ls -A /home/container)" ]; then
|
||||||
|
echo -e "/home/container directory is not empty."
|
||||||
|
|
||||||
|
# Get git origin from /home/container/.git/config
|
||||||
|
if [ -d .git ]; then
|
||||||
|
echo -e ".git directory exists"
|
||||||
|
if [ -f .git/config ]; then
|
||||||
|
echo -e "loading info from git config"
|
||||||
|
ORIGIN=$(git config --get remote.origin.url)
|
||||||
|
else
|
||||||
|
echo -e "files found with no git config"
|
||||||
|
echo -e "closing out without touching things to not break anything"
|
||||||
|
exit 10
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If git origin matches the repo specified by user then pull
|
||||||
|
if [ "${ORIGIN}" == "${GIT_ADDRESS}" ]; then
|
||||||
|
echo "pulling latest from github"
|
||||||
|
git pull && echo "Finished pulling /home/container from Git." || echo "Failed pulling /home/container from Git."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# No files exist in resources folder, clone
|
||||||
|
echo -e "/home/container is empty.\ncloning files into repo"
|
||||||
|
if [ -z ${BRANCH} ]; then
|
||||||
|
echo -e "Cloning default branch into /home/container."
|
||||||
|
git clone ${GIT_ADDRESS} .
|
||||||
|
else
|
||||||
|
echo -e "Cloning ${BRANCH} branch into /home/container."
|
||||||
|
git clone --single-branch --branch ${BRANCH} ${GIT_ADDRESS} . && echo "Finished cloning into /home/container from Git." || echo "Failed cloning into /home/container from Git."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -e "Git disabled."
|
||||||
|
fi
|
||||||
|
|
||||||
# Print Java version
|
# Print Java version
|
||||||
|
printf "\033[1m\033[33mcontainer@pterodactyl~ \033[0mjava -version\n"
|
||||||
java -version
|
java -version
|
||||||
|
|
||||||
# Make internal Docker IP address available to processes.
|
# Convert all of the "{{VARIABLE}}" parts of the command into the expected shell
|
||||||
export INTERNAL_IP=`ip route get 1 | awk '{print $NF;exit}'`
|
# 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 -)")
|
||||||
|
|
||||||
# Replace Startup Variables
|
# Display the command we're running in the output, and then execute it with the env
|
||||||
MODIFIED_STARTUP=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')`
|
# from the container itself.
|
||||||
echo ":/home/container$ ${MODIFIED_STARTUP}"
|
printf "\033[1m\033[33mcontainer@pterodactyl~ \033[0m%s\n" "$PARSED"
|
||||||
|
# shellcheck disable=SC2086
|
||||||
# Run the Server
|
exec env ${PARSED}
|
||||||
eval ${MODIFIED_STARTUP}
|
|
||||||
Reference in new issue
Block a user