From 82941f498f0edc024cd2cade44d2a68f0d6991fa Mon Sep 17 00:00:00 2001 From: gOOvER Date: Sat, 6 Apr 2024 11:02:11 +0200 Subject: [PATCH] update cutom image --- custom/node16132/Dockerfile | 60 +++++++++++++++++++++++++++++++--- custom/node16132/entrypoint.sh | 30 +++++++++++++++-- 2 files changed, 82 insertions(+), 8 deletions(-) diff --git a/custom/node16132/Dockerfile b/custom/node16132/Dockerfile index e8c1527..cfe939b 100644 --- a/custom/node16132/Dockerfile +++ b/custom/node16132/Dockerfile @@ -1,14 +1,64 @@ FROM --platform=$TARGETOS/$TARGETARCH node:16.13.2-bullseye-slim -LABEL author="Michael Parker" maintainer="parker@pterodactyl.io" +LABEL author="Torsten Widmann" maintainer="info@goover.de" +LABEL org.opencontainers.image.source="https://github.com/gOOvER/own-pterodactyl-images" +LABEL org.opencontainers.image.licenses=MIT + +ARG DEBIAN_FRONTEND=noninteractive RUN apt update \ - && apt -y install ffmpeg iproute2 git sqlite3 libsqlite3-dev python3 python3-dev ca-certificates dnsutils tzdata zip libnss3 autoconf automake g++ libtool build-essential pkg-config \ - && useradd -d /home/container -m container + && apt -y upgrade + +RUN apt -y install --no-install-recommends \ + autoconf \ + automake \ + build-essential \ + ca-certificates\ + curl \ + dnsutils \ + ffmpeg \ + g++ \ + git \ + gnupg \ + gnupg2 \ + iproute2 \ + iputils-ping \ + libtool \ + locales \ + python3 \ + python3-dev \ + sqlite3 \ + tzdata \ + tini \ + zip \ + libnss3 \ + libsqlite3-dev + +RUN npm install typescript ts-node @types/node --location=global +# add Yarn +RUN curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ + && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ + && apt update \ + && apt -y install yarn + +# Set the locale +RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \ + locale-gen +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en +ENV LC_ALL en_US.UTF-8 + +## Setup user and working directory +RUN useradd -m -d /home/container -s /bin/bash container USER container ENV USER=container HOME=/home/container WORKDIR /home/container -COPY ./../entrypoint.sh /entrypoint.sh -CMD ["/bin/bash", "/entrypoint.sh"] +# Sets the default stop signal as wings can (currently) only send a kill or generic stop +STOPSIGNAL SIGINT + +COPY --chown=container:container ../entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh +ENTRYPOINT ["/usr/bin/tini", "-g", "--"] +CMD ["/entrypoint.sh"] \ No newline at end of file diff --git a/custom/node16132/entrypoint.sh b/custom/node16132/entrypoint.sh index 8615547..56d0875 100644 --- a/custom/node16132/entrypoint.sh +++ b/custom/node16132/entrypoint.sh @@ -1,12 +1,36 @@ #!/bin/bash -cd /home/container +#System variables +clear +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' + +# Switch to the container's working directory +cd /home/container || exit 1 + +# Wait for the container to fully initialize +sleep 1 + +# 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 -# Print Node.js Version -node -v +# system informations +echo -e "${BLUE}---------------------------------------------------------------------${NC}" +echo -e "${RED}NodeJS Image by gOOvER${NC}" +echo -e "${BLUE}---------------------------------------------------------------------${NC}" +echo -e "${YELLOW}Running on Debian: ${RED} $(cat /etc/debian_version)${NC}" +echo -e "${YELLOW}Current timezone: ${RED} $(cat /etc/timezone)${NC}" +echo -e "${BLUE}---------------------------------------------------------------------${NC}" +echo -e "${YELLOW}NodeJS Version: ${RED} $(node -v) ${NC}" +echo -e "${YELLOW}npm Version: ${RED} $(npm -v) ${NC}" +echo -e "${BLUE}---------------------------------------------------------------------${NC}" # Replace Startup Variables MODIFIED_STARTUP=$(echo -e ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')