diff --git a/build/Dockerfile b/build/Dockerfile index 3cc47eb..e24a728 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,27 +1,34 @@ -FROM php:7.2-apache +FROM ubuntu:latest MAINTAINER ex0nuss +## for apt to be noninteractive +ENV DEBIAN_FRONTEND noninteractive +ENV DEBCONF_NONINTERACTIVE_SEEN true + +#--no-install-recommends RUN apt-get -y update && \ - apt install -y --no-install-recommends \ + apt install -y \ + apache2 \ + php \ + libapache2-mod-php \ + libcurl4-gnutls-dev \ iputils-ping \ wakeonlan \ git -#RUN docker-php-ext-install curl -RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" -RUN chmod u+s `which ping` -RUN git clone https://github.com/sciguy14/Remote-Wake-Sleep-On-LAN-Server.git +WORKDIR /root +RUN git clone https://github.com/sciguy14/Remote-Wake-Sleep-On-LAN-Server.git &&\ + chown root: /var/www/html &&\ + chmod u+s `which ping` -WORKDIR /var/www/html +COPY ports.conf /etc/apache2/ RUN a2enmod headers &&\ service apache2 restart -RUN mv -f Remote-Wake-Sleep-On-LAN-Server/000-default.conf /etc/apache2/sites-available/000-default.conf -COPY ports.conf /etc/apache2/ - -RUN sed -i.bak "s/expose_php = On/expose_php = Off/g" $PHP_INI_DIR/php.ini &&\ - sed -i.bak "s/E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED/error_reporting = E_ERROR/g" $PHP_INI_DIR/php.ini &&\ +RUN mv -f Remote-Wake-Sleep-On-LAN-Server/000-default.conf /etc/apache2/sites-available/000-default.conf &&\ + sed -i.bak "s/expose_php = On/expose_php = Off/g" /etc/php/7.4/apache2/php.ini &&\ + sed -i.bak "s/E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED/error_reporting = E_ERROR/g" /etc/php/7.4/apache2/php.ini &&\ sed -i.bak "s/ServerSignature On/ServerSignature Off/g" /etc/apache2/conf-available/security.conf &&\ sed -i.bak "s/ServerTokens OS/ServerTokens Prod/g" /etc/apache2/conf-available/security.conf &&\ service apache2 restart @@ -30,7 +37,6 @@ RUN mv Remote-Wake-Sleep-On-LAN-Server/* /var/www/html &&\ mv Remote-Wake-Sleep-On-LAN-Server/.htaccess /var/www/html &&\ rm -rf Remote-Wake-Sleep-On-LAN-Server/ &&\ rm -f /var/www/html/index.html -# mv /var/www/html/config_sample.php /var/www/html/config.php COPY config.php /var/www/html/config.php COPY entrypoint.sh / @@ -38,7 +44,7 @@ COPY entrypoint.sh / ENV APACHE2_PORT=80 ENV PASSPHRASE= ENV RWSOLS_MAX_PINGS=15 -ENV RWSOL_SLEEP_TIME=5 +ENV RWSOLS_SLEEP_TIME=5 ENV RWSOLS_COMPUTER_NAME= ENV RWSOLS_COMPUTER_MAC= ENV RWSOLS_COMPUTER_IP= diff --git a/build/config.php b/build/config.php index 7e1a9b2..def253e 100644 --- a/build/config.php +++ b/build/config.php @@ -20,7 +20,7 @@ // This is the number of times that the WOL server will try to ping the target computer to check if it has woken up. Default = 15. $MAX_PINGS = REPLACE_RWSOLS_MAX_PINGS; // This is the number of seconds to wait between pings commands when waking up or sleeping. Waking from shutdown or sleep will impact this. - $SLEEP_TIME = REPLACE_RWSOL_SLEEP_TIME; + $SLEEP_TIME = REPLACE_RWSOLS_SLEEP_TIME; // This is the Name of the computers to appear in the drop down $COMPUTER_NAME = array(REPLACE_RWSOLS_COMPUTER_NAME); diff --git a/build/entrypoint.sh b/build/entrypoint.sh index 0e69cde..8ea9f41 100755 --- a/build/entrypoint.sh +++ b/build/entrypoint.sh @@ -24,16 +24,10 @@ search_and_replace RWSOLS_HASH $RWSOLS_HASH #APACHE2 port mapping -echo "search_and_replace port 80 with $APACHE2_PORT" -sed -i 's|'80'|'$APACHE2_PORT'|g' '/etc/apache2/ports.conf' +echo "search_and_replace port 8080 with $APACHE2_PORT" +sed -i 's|'8080'|'$APACHE2_PORT'|g' '/etc/apache2/ports.conf' #Starting apache2 -service apache2 reload -exec apache2-foreground - - -#TODO -# 1. PHP-Arrays mit env vars testen: z.B. RWSOLS_COMPUTER_NAME="PcTest","PcTest1" -# 2. Für alle Config-Settings Env vars erstellen -# 3. Hash for Keyphrase erstellen +echo "Starting Apache2: /usr/sbin/apache2ctl -D FOREGROUND" +/usr/sbin/apache2ctl -D FOREGROUND diff --git a/build/ports.conf b/build/ports.conf index 5daec58..03d5dd2 100644 --- a/build/ports.conf +++ b/build/ports.conf @@ -2,7 +2,7 @@ # have to change the VirtualHost statement in # /etc/apache2/sites-enabled/000-default.conf -Listen 80 +Listen 8080 Listen 443 diff --git a/config.php b/config.php new file mode 100644 index 0000000..685b296 --- /dev/null +++ b/config.php @@ -0,0 +1,50 @@ + diff --git a/docker-compose.yml b/docker-compose.yml index f271328..f44954b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,18 +7,12 @@ services: container_name: development-rwsols # restart: unless-stopped network_mode: host -# ports: -# - 9999:81 -# volumes: -# - environment: - - APACHE2_PORT=81 - - PASSPHRASE=Test - - RWSOLS_COMPUTER_NAME="HansPc","OMV-nas" - - RWSOLS_COMPUTER_MAC="54:04:A6:3C:B2:D5","AA:AA:AA" - - RWSOLS_COMPUTER_IP="192.168.178.45","192.168.178.100" - labels: - - com.centurylinklabs.watchtower.enable=false + - APACHE2_PORT=9898 + - PASSPHRASE=MyPassword + - RWSOLS_COMPUTER_NAME="Pc1","Pc2" + - RWSOLS_COMPUTER_MAC="XX:XX:XX:XX:XX:XX","XX:XX:XX:XX:XX:XX" + - RWSOLS_COMPUTER_IP="192.168.1.45","192.168.1.50" ### ENV-file presets ### # Europe/Berlin diff --git a/docker-compose.yml.save b/docker-compose.yml.save deleted file mode 100644 index 475723c..0000000 --- a/docker-compose.yml.save +++ /dev/null @@ -1,22 +0,0 @@ -RWSOLS_COMPUTER_IPversion: "3" - -services: - development-rwsols: - build: ./build -# image: ex0nuss/plex-export-docker - container_name: development-rwsols -# restart: unless-stopped - ports: - - 9999:80 -# volumes: -# - - environment: - - RWSOLS_COMPUTER_NAME=PcTest - - RWSOLS_COMPUTER_MAC=FF:FF:32:FF - - RWSOLS_IP=192.168.178.1 - labels: - - com.centurylinklabs.watchtower.enable=false - -### ENV-file presets ### -# Europe/Berlin -# 996