diff --git a/Dockerfile b/Dockerfile index 09ed53399..216f79f8a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,28 +1,52 @@ FROM ubuntu:22.04 ARG DEBIAN_FRONTEND="noninteractive" +ENV DUMB_INIT_BASE_URL="https://github.com/Yelp/dumb-init/releases/download/v1.2.5" -# Install prerequisites and curl -RUN apt-get update && apt-get -y install curl software-properties-common && \ - add-apt-repository -u ppa:deluge-team/stable && \ - apt-get update && \ - # Download and install dumb-init manually based on architecture - arch=$(dpkg --print-architecture) && \ - if [ "$arch" = "arm64" ]; then arch="aarch64"; fi && \ - curl -Lo /tmp/dumb-init.deb "https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_${arch}.deb" && \ - dpkg -i /tmp/dumb-init.deb && rm -f /tmp/dumb-init.deb && \ - # Install other dependencies - apt-get -y install iputils-ping dnsutils bash jq net-tools openvpn curl ufw deluged deluge-web p7zip-full unrar unzip && \ - echo "Cleanup" && \ - rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/* && \ - echo "Adding user" && \ - groupmod -g 1000 users && \ +# Step 1: Install prerequisites +RUN apt-get update && apt-get -y install curl software-properties-common + +# Step 2: Add the Deluge PPA and update apt cache +RUN add-apt-repository -u ppa:deluge-team/stable && apt-get update + +# Step 3: Download dumb-init asset based on architecture +RUN arch=$(dpkg --print-architecture) && \ + if [ "$arch" = "arm64" ]; then \ + asset="dumb-init_1.2.5_aarch64"; \ + elif [ "$arch" = "amd64" ]; then \ + asset="dumb-init_1.2.5_amd64.deb"; \ + else \ + echo "Unsupported architecture: $arch" && exit 1; \ + fi && \ + echo "Downloading dumb-init asset: $asset" && \ + curl -Lo /tmp/dumb-init "$DUMB_INIT_BASE_URL/$asset" + +# Step 4: Install dumb-init based on asset type +RUN arch=$(dpkg --print-architecture) && \ + if [ "$arch" = "amd64" ]; then \ + dpkg-deb -x /tmp/dumb-init /tmp/dumb-init-dir && \ + cp /tmp/dumb-init-dir/usr/bin/dumb-init /usr/local/bin/dumb-init; \ + else \ + cp /tmp/dumb-init /usr/local/bin/dumb-init; \ + fi && \ + chmod +x /usr/local/bin/dumb-init && \ + rm -rf /tmp/dumb-init /tmp/dumb-init-dir + +# Step 5: Install other dependencies +RUN apt-get -y install iputils-ping dnsutils bash jq net-tools openvpn curl ufw deluged deluge-web p7zip-full unrar unzip + +# Step 6: Clean up apt cache and temporary files +RUN rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/* + +# Step 7: Add the user "abc" +RUN groupmod -g 1000 users && \ useradd -u 911 -U -d /config -s /bin/false abc && \ usermod -G users abc -# Add configuration and scripts +# Step 8: Copy configuration and scripts COPY root/ / +# Step 9: Set environment variables ENV OPENVPN_USERNAME=**None** \ OPENVPN_PASSWORD=**None** \ OPENVPN_PROVIDER=**None** \ @@ -52,9 +76,9 @@ ENV OPENVPN_USERNAME=**None** \ DELUGE_OUTGOING_PORT_LOW=63394 \ DELUGE_OUTGOING_PORT_HIGH=63404 +# Step 10: Configure health check and expose ports HEALTHCHECK --interval=1m CMD /etc/scripts/healthcheck.sh - -# Deluge Deamon and web EXPOSE 8112 58846 -CMD ["/usr/bin/dumb-init", "/etc/openvpn/init.sh"] +# Step 11: Set default command +CMD ["/usr/bin/dumb-init", "/etc/openvpn/init.sh"] \ No newline at end of file