diff --git a/bots/sinusbot/Dockerfile b/bots/sinusbot/Dockerfile index 8132669..1ab48d6 100644 --- a/bots/sinusbot/Dockerfile +++ b/bots/sinusbot/Dockerfile @@ -7,18 +7,54 @@ ENV DEBIAN_FRONTEND noninteractive # Install Dependencies RUN apt update \ && apt upgrade -y \ - && apt install -y ca-certificates less locales pulseaudio python3 sudo x11vnc x11-xkb-utils xvfb iproute2 ffmpeg curl \ - libasound2 libegl1-mesa libglib2.0-0 libnss3 libpci3 libpulse0 libxcursor1 libxslt1.1 libx11-xcb1 libxkbcommon0 \ - && useradd -m -d /home/container container + && apt install -y \ + ca-certificates \ + less \ + locales \ + pulseaudio \ + python3 \ + sudo \ + x11vnc \ + x11-xkb-utils \ + xvfb \ + iproute2 \ + ffmpeg \ + curl \ + libasound2 \ + libegl1-mesa \ + libglib2.0-0 \ + libnss3 \ + libpci3 \ + libpulse0 \ + libxcursor1 \ + libxslt1.1 \ + libx11-xcb1 \ + libxkbcommon0 \ + tini RUN curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl \ - && chmod a+rx /usr/local/bin/youtube-dl -ENV LANG C.UTF-8 -ENV LC_ALL C.UTF-8 + && chmod a+rx /usr/local/bin/youtube-dl -USER container +# 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 +# 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"] + COPY ./entrypoint.sh /entrypoint.sh CMD ["/bin/bash", "/entrypoint.sh"] diff --git a/bots/sinusbot/entrypoint.sh b/bots/sinusbot/entrypoint.sh index d0aea75..b73d832 100644 --- a/bots/sinusbot/entrypoint.sh +++ b/bots/sinusbot/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 +# system informations +echo -e "${BLUE}-------------------------------------------------${NC}" +echo -e "${RED}Sinusbot 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}" + # Replace Startup Variables -MODIFIED_STARTUP=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')` +MODIFIED_STARTUP=$(echo -e ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g') echo ":/home/container$ ${MODIFIED_STARTUP}" # Run the Server