From 1107f0e9e2e14841d0830c1244c02c3a639a0599 Mon Sep 17 00:00:00 2001 From: Macleykun Date: Sun, 12 Jun 2022 14:48:17 +0200 Subject: [PATCH 01/21] Fix WARNING: apt does not have a stable CLI interface. Use with caution in scripts. --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 691932fd..8f2ccd28 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,9 +4,9 @@ ARG dir="/home/pi/pialert" #Update and reduce image size RUN apt update \ - && apt install --no-install-recommends apt-utils cron sudo lighttpd php php-cgi php-fpm php-sqlite3 sqlite3 dnsutils net-tools python iproute2 -y \ + && apt-get install --no-install-recommends apt-utils cron sudo lighttpd php php-cgi php-fpm php-sqlite3 sqlite3 dnsutils net-tools python iproute2 -y \ #Install without the --no-install-recommends flag - && apt install curl arp-scan -y \ + && apt-get install curl arp-scan -y \ #clean-up && apt clean autoclean \ && apt autoremove From 7413bf57ab98f74ce65ba8c35bafe746a5bc3d4a Mon Sep 17 00:00:00 2001 From: Macleykun Date: Sun, 12 Jun 2022 14:50:08 +0200 Subject: [PATCH 02/21] Also for the apt-get update fix unstable interface with apt --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 8f2ccd28..fbf756c1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM debian:buster-slim ARG dir="/home/pi/pialert" #Update and reduce image size -RUN apt update \ +RUN apt-get update \ && apt-get install --no-install-recommends apt-utils cron sudo lighttpd php php-cgi php-fpm php-sqlite3 sqlite3 dnsutils net-tools python iproute2 -y \ #Install without the --no-install-recommends flag && apt-get install curl arp-scan -y \ From 8649805ab34fe6dce68c6aebff321972fa226df8 Mon Sep 17 00:00:00 2001 From: Macleykun Date: Sun, 12 Jun 2022 14:52:21 +0200 Subject: [PATCH 03/21] Made sure to make script already executable using git, no need to do it again in Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index fbf756c1..80ec0aef 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,6 +40,6 @@ RUN ln -s $dir/front /var/www/html/pialert \ EXPOSE 20211 # Set up startup script to run two commands, cron and the lighttpd server -RUN chmod +x $dir/dockerfiles/start.sh +# RUN chmod +x $dir/dockerfiles/start.sh CMD ["/home/pi/pialert/dockerfiles/start.sh"] From 2da132393f530ef30343b131647b85161dd29400 Mon Sep 17 00:00:00 2001 From: Macleykun Date: Sun, 12 Jun 2022 14:54:57 +0200 Subject: [PATCH 04/21] Make the installation of packages as adviced (and apt-get to have a stable interface) --- Dockerfile | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 80ec0aef..f19834c6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,14 +2,10 @@ FROM debian:buster-slim ARG dir="/home/pi/pialert" -#Update and reduce image size RUN apt-get update \ - && apt-get install --no-install-recommends apt-utils cron sudo lighttpd php php-cgi php-fpm php-sqlite3 sqlite3 dnsutils net-tools python iproute2 -y \ - #Install without the --no-install-recommends flag - && apt-get install curl arp-scan -y \ - #clean-up - && apt clean autoclean \ - && apt autoremove + && apt-get install --no-install-recommends apt-utils cron sudo lighttpd php php-cgi php-fpm php-sqlite3 sqlite3 dnsutils net-tools python iproute2 curl arp-scan -y \ + && apt-get clean autoclean \ + && rm -rf /var/lib/apt/lists/* #add the pi user RUN useradd -ms /bin/bash pi From 0d1d5a6ad700096f175984518dbd63e79a672c59 Mon Sep 17 00:00:00 2001 From: Macleykun Date: Sun, 12 Jun 2022 14:59:26 +0200 Subject: [PATCH 05/21] revert to working --- Dockerfile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index f19834c6..691932fd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,10 +2,14 @@ FROM debian:buster-slim ARG dir="/home/pi/pialert" -RUN apt-get update \ - && apt-get install --no-install-recommends apt-utils cron sudo lighttpd php php-cgi php-fpm php-sqlite3 sqlite3 dnsutils net-tools python iproute2 curl arp-scan -y \ - && apt-get clean autoclean \ - && rm -rf /var/lib/apt/lists/* +#Update and reduce image size +RUN apt update \ + && apt install --no-install-recommends apt-utils cron sudo lighttpd php php-cgi php-fpm php-sqlite3 sqlite3 dnsutils net-tools python iproute2 -y \ + #Install without the --no-install-recommends flag + && apt install curl arp-scan -y \ + #clean-up + && apt clean autoclean \ + && apt autoremove #add the pi user RUN useradd -ms /bin/bash pi @@ -36,6 +40,6 @@ RUN ln -s $dir/front /var/www/html/pialert \ EXPOSE 20211 # Set up startup script to run two commands, cron and the lighttpd server -# RUN chmod +x $dir/dockerfiles/start.sh +RUN chmod +x $dir/dockerfiles/start.sh CMD ["/home/pi/pialert/dockerfiles/start.sh"] From 7fe4f529568912cbe684ec9e8bc47bc01c09ce96 Mon Sep 17 00:00:00 2001 From: Macleykun Date: Sun, 12 Jun 2022 15:01:17 +0200 Subject: [PATCH 06/21] use apt-get for stable cli --- Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 691932fd..924211ad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,13 +3,13 @@ FROM debian:buster-slim ARG dir="/home/pi/pialert" #Update and reduce image size -RUN apt update \ - && apt install --no-install-recommends apt-utils cron sudo lighttpd php php-cgi php-fpm php-sqlite3 sqlite3 dnsutils net-tools python iproute2 -y \ +RUN apt-get update \ + && apt-get install --no-install-recommends apt-utils cron sudo lighttpd php php-cgi php-fpm php-sqlite3 sqlite3 dnsutils net-tools python iproute2 -y \ #Install without the --no-install-recommends flag - && apt install curl arp-scan -y \ + && apt-get install curl arp-scan -y \ #clean-up - && apt clean autoclean \ - && apt autoremove + && apt-get clean autoclean \ + && apt-get autoremove #add the pi user RUN useradd -ms /bin/bash pi From f3498ebbe128d9e1888347125914873e6464218a Mon Sep 17 00:00:00 2001 From: Macleykun Date: Sun, 12 Jun 2022 15:02:55 +0200 Subject: [PATCH 07/21] remove cache aot --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 924211ad..21aa65d8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,8 @@ RUN apt-get update \ && apt-get install curl arp-scan -y \ #clean-up && apt-get clean autoclean \ - && apt-get autoremove + && apt-get autoremove \ + && rm -rf /var/lib/apt/lists/* #add the pi user RUN useradd -ms /bin/bash pi From fb8102bd015d0fc462d7fb9ecfd787dbf6797408 Mon Sep 17 00:00:00 2001 From: Macleykun Date: Sun, 12 Jun 2022 15:12:57 +0200 Subject: [PATCH 08/21] Remove confusing way of an dir arg while using a workdir --- Dockerfile | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 21aa65d8..af107edb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,8 @@ FROM debian:buster-slim -ARG dir="/home/pi/pialert" +#add the pi user +RUN useradd -ms /bin/bash pi +WORKDIR /home/pi/pialert #Update and reduce image size RUN apt-get update \ @@ -12,27 +14,23 @@ RUN apt-get update \ && apt-get autoremove \ && rm -rf /var/lib/apt/lists/* -#add the pi user -RUN useradd -ms /bin/bash pi -WORKDIR /home/pi - # Lighttpd & PHP RUN mv /var/www/html/index.lighttpd.html /var/www/html/index.lighttpd.html.old \ - && ln -s $dir/install/index.html /var/www/html/index.html \ + && ln -s ./install/index.html /var/www/html/index.html \ && lighttpd-enable-mod fastcgi-php -COPY . $dir +COPY . . # delete .git/ files and the tar/ realese directory to make the image smaller -#RUN rm -r $dir/.git \ -RUN rm -r $dir/tar +#RUN rm -r ./.git \ +RUN rm -r ./tar # Pi.Alert -RUN ln -s $dir/front /var/www/html/pialert \ - && python $dir/back/pialert.py update_vendors \ - && (crontab -l 2>/dev/null; cat $dir/install/pialert.cron) | crontab - \ - && chgrp -R www-data $dir/db \ - && chmod -R 770 $dir/db \ +RUN ln -s ./front /var/www/html/pialert \ + && python ./back/pialert.py update_vendors \ + && (crontab -l 2>/dev/null; cat ./install/pialert.cron) | crontab - \ + && chgrp -R www-data ./db \ + && chmod -R 770 ./db \ # changing the default port number 80 to something random, here 20211 && sed -ie 's/= 80/= 20211/g' /etc/lighttpd/lighttpd.conf \ && service lighttpd restart @@ -41,6 +39,6 @@ RUN ln -s $dir/front /var/www/html/pialert \ EXPOSE 20211 # Set up startup script to run two commands, cron and the lighttpd server -RUN chmod +x $dir/dockerfiles/start.sh +RUN chmod +x ./dockerfiles/start.sh CMD ["/home/pi/pialert/dockerfiles/start.sh"] From 5f5cc13d1a42195e0a74cba567c1e6a6af26b67b Mon Sep 17 00:00:00 2001 From: Macleykun Date: Sun, 12 Jun 2022 15:32:26 +0200 Subject: [PATCH 09/21] revert b/c 403 error --- Dockerfile | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index af107edb..17a347fe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,6 @@ FROM debian:buster-slim -#add the pi user -RUN useradd -ms /bin/bash pi -WORKDIR /home/pi/pialert +ARG dir="/home/pi/pialert" #Update and reduce image size RUN apt-get update \ @@ -14,23 +12,24 @@ RUN apt-get update \ && apt-get autoremove \ && rm -rf /var/lib/apt/lists/* + # Lighttpd & PHP RUN mv /var/www/html/index.lighttpd.html /var/www/html/index.lighttpd.html.old \ - && ln -s ./install/index.html /var/www/html/index.html \ + && ln -s $dir/install/index.html /var/www/html/index.html \ && lighttpd-enable-mod fastcgi-php -COPY . . +COPY . $dir # delete .git/ files and the tar/ realese directory to make the image smaller -#RUN rm -r ./.git \ -RUN rm -r ./tar +#RUN rm -r $dir/.git \ +RUN rm -r $dir/tar # Pi.Alert -RUN ln -s ./front /var/www/html/pialert \ - && python ./back/pialert.py update_vendors \ - && (crontab -l 2>/dev/null; cat ./install/pialert.cron) | crontab - \ - && chgrp -R www-data ./db \ - && chmod -R 770 ./db \ +RUN ln -s $dir/front /var/www/html/pialert \ + && python $dir/back/pialert.py update_vendors \ + && (crontab -l 2>/dev/null; cat $dir/install/pialert.cron) | crontab - \ + && chgrp -R www-data $dir/db \ + && chmod -R 770 $dir/db \ # changing the default port number 80 to something random, here 20211 && sed -ie 's/= 80/= 20211/g' /etc/lighttpd/lighttpd.conf \ && service lighttpd restart @@ -39,6 +38,6 @@ RUN ln -s ./front /var/www/html/pialert \ EXPOSE 20211 # Set up startup script to run two commands, cron and the lighttpd server -RUN chmod +x ./dockerfiles/start.sh +RUN chmod +x $dir/dockerfiles/start.sh CMD ["/home/pi/pialert/dockerfiles/start.sh"] From 3a39d9d6e25c2e4aab18307366d62adb9b0beae9 Mon Sep 17 00:00:00 2001 From: Macleykun Date: Sun, 12 Jun 2022 15:33:39 +0200 Subject: [PATCH 10/21] Remove arg and start a little safer this time --- Dockerfile | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 17a347fe..d0aa0ed7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,5 @@ FROM debian:buster-slim -ARG dir="/home/pi/pialert" - #Update and reduce image size RUN apt-get update \ && apt-get install --no-install-recommends apt-utils cron sudo lighttpd php php-cgi php-fpm php-sqlite3 sqlite3 dnsutils net-tools python iproute2 -y \ @@ -15,21 +13,21 @@ RUN apt-get update \ # Lighttpd & PHP RUN mv /var/www/html/index.lighttpd.html /var/www/html/index.lighttpd.html.old \ - && ln -s $dir/install/index.html /var/www/html/index.html \ + && ln -s /home/pi/pialert/install/index.html /var/www/html/index.html \ && lighttpd-enable-mod fastcgi-php -COPY . $dir +COPY . /home/pi/pialert # delete .git/ files and the tar/ realese directory to make the image smaller -#RUN rm -r $dir/.git \ -RUN rm -r $dir/tar +#RUN rm -r /home/pi/pialert/.git \ +RUN rm -r /home/pi/pialert/tar # Pi.Alert -RUN ln -s $dir/front /var/www/html/pialert \ - && python $dir/back/pialert.py update_vendors \ - && (crontab -l 2>/dev/null; cat $dir/install/pialert.cron) | crontab - \ - && chgrp -R www-data $dir/db \ - && chmod -R 770 $dir/db \ +RUN ln -s /home/pi/pialert/front /var/www/html/pialert \ + && python /home/pi/pialert/back/pialert.py update_vendors \ + && (crontab -l 2>/dev/null; cat /home/pi/pialert/install/pialert.cron) | crontab - \ + && chgrp -R www-data /home/pi/pialert/db \ + && chmod -R 770 /home/pi/pialert/db \ # changing the default port number 80 to something random, here 20211 && sed -ie 's/= 80/= 20211/g' /etc/lighttpd/lighttpd.conf \ && service lighttpd restart @@ -38,6 +36,6 @@ RUN ln -s $dir/front /var/www/html/pialert \ EXPOSE 20211 # Set up startup script to run two commands, cron and the lighttpd server -RUN chmod +x $dir/dockerfiles/start.sh +RUN chmod +x /home/pi/pialert/dockerfiles/start.sh CMD ["/home/pi/pialert/dockerfiles/start.sh"] From abb45289ee3db9995ece48e4bbc981589e7df66b Mon Sep 17 00:00:00 2001 From: Macleykun Date: Sun, 12 Jun 2022 15:38:33 +0200 Subject: [PATCH 11/21] use workdir properly hopefully --- Dockerfile | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index d0aa0ed7..f13eeb97 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ FROM debian:buster-slim +WORKDIR /home/pi/pialert/ + #Update and reduce image size RUN apt-get update \ && apt-get install --no-install-recommends apt-utils cron sudo lighttpd php php-cgi php-fpm php-sqlite3 sqlite3 dnsutils net-tools python iproute2 -y \ @@ -13,21 +15,21 @@ RUN apt-get update \ # Lighttpd & PHP RUN mv /var/www/html/index.lighttpd.html /var/www/html/index.lighttpd.html.old \ - && ln -s /home/pi/pialert/install/index.html /var/www/html/index.html \ + && ln -s install/index.html /var/www/html/index.html \ && lighttpd-enable-mod fastcgi-php COPY . /home/pi/pialert # delete .git/ files and the tar/ realese directory to make the image smaller -#RUN rm -r /home/pi/pialert/.git \ -RUN rm -r /home/pi/pialert/tar +#RUN rm -r .git \ +RUN rm -r tar # Pi.Alert -RUN ln -s /home/pi/pialert/front /var/www/html/pialert \ - && python /home/pi/pialert/back/pialert.py update_vendors \ - && (crontab -l 2>/dev/null; cat /home/pi/pialert/install/pialert.cron) | crontab - \ - && chgrp -R www-data /home/pi/pialert/db \ - && chmod -R 770 /home/pi/pialert/db \ +RUN ln -s front /var/www/html/pialert \ + && python back/pialert.py update_vendors \ + && (crontab -l 2>/dev/null; cat install/pialert.cron) | crontab - \ + && chgrp -R www-data db \ + && chmod -R 770 db \ # changing the default port number 80 to something random, here 20211 && sed -ie 's/= 80/= 20211/g' /etc/lighttpd/lighttpd.conf \ && service lighttpd restart @@ -36,6 +38,6 @@ RUN ln -s /home/pi/pialert/front /var/www/html/pialert \ EXPOSE 20211 # Set up startup script to run two commands, cron and the lighttpd server -RUN chmod +x /home/pi/pialert/dockerfiles/start.sh +RUN chmod +x dockerfiles/start.sh -CMD ["/home/pi/pialert/dockerfiles/start.sh"] +CMD ["dockerfiles/start.sh"] From 3d904cbd31197171865c772c19bf77ea6970b572 Mon Sep 17 00:00:00 2001 From: Macleykun Date: Sun, 12 Jun 2022 15:43:16 +0200 Subject: [PATCH 12/21] revert again clean a litle up --- Dockerfile | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index f13eeb97..2cd16e09 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,35 +1,27 @@ FROM debian:buster-slim -WORKDIR /home/pi/pialert/ - -#Update and reduce image size RUN apt-get update \ - && apt-get install --no-install-recommends apt-utils cron sudo lighttpd php php-cgi php-fpm php-sqlite3 sqlite3 dnsutils net-tools python iproute2 -y \ - #Install without the --no-install-recommends flag - && apt-get install curl arp-scan -y \ - #clean-up + && apt-get install --no-install-recommends curl arp-scan apt-utils cron sudo lighttpd php php-cgi php-fpm php-sqlite3 sqlite3 dnsutils net-tools python iproute2 -y \ && apt-get clean autoclean \ && apt-get autoremove \ && rm -rf /var/lib/apt/lists/* - # Lighttpd & PHP RUN mv /var/www/html/index.lighttpd.html /var/www/html/index.lighttpd.html.old \ - && ln -s install/index.html /var/www/html/index.html \ + && ln -s /home/pi/pialert/install/index.html /var/www/html/index.html \ && lighttpd-enable-mod fastcgi-php COPY . /home/pi/pialert # delete .git/ files and the tar/ realese directory to make the image smaller -#RUN rm -r .git \ -RUN rm -r tar +RUN rm -r /home/pi/pialert/tar # Pi.Alert -RUN ln -s front /var/www/html/pialert \ - && python back/pialert.py update_vendors \ - && (crontab -l 2>/dev/null; cat install/pialert.cron) | crontab - \ - && chgrp -R www-data db \ - && chmod -R 770 db \ +RUN ln -s /home/pi/pialert/front /var/www/html/pialert \ + && python /home/pi/pialert/back/pialert.py update_vendors \ + && (crontab -l 2>/dev/null; cat /home/pi/pialert/install/pialert.cron) | crontab - \ + && chgrp -R www-data /home/pi/pialert/db \ + && chmod -R 770 /home/pi/pialert/db \ # changing the default port number 80 to something random, here 20211 && sed -ie 's/= 80/= 20211/g' /etc/lighttpd/lighttpd.conf \ && service lighttpd restart @@ -38,6 +30,6 @@ RUN ln -s front /var/www/html/pialert \ EXPOSE 20211 # Set up startup script to run two commands, cron and the lighttpd server -RUN chmod +x dockerfiles/start.sh +RUN chmod +x /home/pi/pialert/dockerfiles/start.sh -CMD ["dockerfiles/start.sh"] +CMD ["/home/pi/pialert/dockerfiles/start.sh"] From 5c2fd1f2b58a649f38c301e99a2cfca33bccc2ae Mon Sep 17 00:00:00 2001 From: Macleykun Date: Sun, 12 Jun 2022 15:44:17 +0200 Subject: [PATCH 13/21] smol update --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 2cd16e09..d95d70bd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,4 +32,4 @@ EXPOSE 20211 # Set up startup script to run two commands, cron and the lighttpd server RUN chmod +x /home/pi/pialert/dockerfiles/start.sh -CMD ["/home/pi/pialert/dockerfiles/start.sh"] +CMD ["/home/pi/pialert/dockerfiles/start.sh"] \ No newline at end of file From 7e25878eeb4ff361ca0953fbe67971366275bae2 Mon Sep 17 00:00:00 2001 From: Macleykun Date: Sun, 12 Jun 2022 15:46:59 +0200 Subject: [PATCH 14/21] probaly we missing ca-certifciates --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index d95d70bd..2ad7033c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM debian:buster-slim RUN apt-get update \ - && apt-get install --no-install-recommends curl arp-scan apt-utils cron sudo lighttpd php php-cgi php-fpm php-sqlite3 sqlite3 dnsutils net-tools python iproute2 -y \ + && apt-get install --no-install-recommends ca-certificates curl arp-scan apt-utils cron sudo lighttpd php php-cgi php-fpm php-sqlite3 sqlite3 dnsutils net-tools python iproute2 -y \ && apt-get clean autoclean \ && apt-get autoremove \ && rm -rf /var/lib/apt/lists/* @@ -14,6 +14,7 @@ RUN mv /var/www/html/index.lighttpd.html /var/www/html/index.lighttpd.html.old \ COPY . /home/pi/pialert # delete .git/ files and the tar/ realese directory to make the image smaller +#RUN rm -r /home/pi/pialert/.git \ RUN rm -r /home/pi/pialert/tar # Pi.Alert @@ -32,4 +33,4 @@ EXPOSE 20211 # Set up startup script to run two commands, cron and the lighttpd server RUN chmod +x /home/pi/pialert/dockerfiles/start.sh -CMD ["/home/pi/pialert/dockerfiles/start.sh"] \ No newline at end of file +CMD ["/home/pi/pialert/dockerfiles/start.sh"] From cbf1281b25b8b98a165f556af8652e79689ee393 Mon Sep 17 00:00:00 2001 From: Macleykun Date: Sun, 12 Jun 2022 15:52:47 +0200 Subject: [PATCH 15/21] maybe this works? --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 2ad7033c..f5f55157 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,8 @@ FROM debian:buster-slim RUN apt-get update \ - && apt-get install --no-install-recommends ca-certificates curl arp-scan apt-utils cron sudo lighttpd php php-cgi php-fpm php-sqlite3 sqlite3 dnsutils net-tools python iproute2 -y \ + && apt-get install --no-install-recommends ca-certificates curl apt-utils cron sudo lighttpd php php-cgi php-fpm php-sqlite3 sqlite3 dnsutils net-tools python iproute2 -y \ + && apt-get install arp-scan -y \ && apt-get clean autoclean \ && apt-get autoremove \ && rm -rf /var/lib/apt/lists/* From 3a79ff636ba9ce70b3c36302da55f23ce380caf3 Mon Sep 17 00:00:00 2001 From: Macleykun Date: Sun, 12 Jun 2022 15:55:41 +0200 Subject: [PATCH 16/21] we missing perl? --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index f5f55157..10163a6f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,7 @@ FROM debian:buster-slim RUN apt-get update \ - && apt-get install --no-install-recommends ca-certificates curl apt-utils cron sudo lighttpd php php-cgi php-fpm php-sqlite3 sqlite3 dnsutils net-tools python iproute2 -y \ - && apt-get install arp-scan -y \ + && apt-get install --no-install-recommends ca-certificates curl arp-scan perl apt-utils cron sudo lighttpd php php-cgi php-fpm php-sqlite3 sqlite3 dnsutils net-tools python iproute2 -y \ && apt-get clean autoclean \ && apt-get autoremove \ && rm -rf /var/lib/apt/lists/* From d666255254bbf0f64371b56329f2ea2c98cfc7ac Mon Sep 17 00:00:00 2001 From: Macleykun Date: Sun, 12 Jun 2022 15:58:45 +0200 Subject: [PATCH 17/21] lovely stuff libwww-perl --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 10163a6f..e6418c84 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM debian:buster-slim RUN apt-get update \ - && apt-get install --no-install-recommends ca-certificates curl arp-scan perl apt-utils cron sudo lighttpd php php-cgi php-fpm php-sqlite3 sqlite3 dnsutils net-tools python iproute2 -y \ + && apt-get install --no-install-recommends ca-certificates curl libwww-perl arp-scan perl apt-utils cron sudo lighttpd php php-cgi php-fpm php-sqlite3 sqlite3 dnsutils net-tools python iproute2 -y \ && apt-get clean autoclean \ && apt-get autoremove \ && rm -rf /var/lib/apt/lists/* From 0c3ceede24bfd7fe5ab33620ca71cdd3b2f6016f Mon Sep 17 00:00:00 2001 From: MacleyKun Date: Sun, 12 Jun 2022 14:02:57 +0000 Subject: [PATCH 18/21] make start.sh executable by default --- dockerfiles/start.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 dockerfiles/start.sh diff --git a/dockerfiles/start.sh b/dockerfiles/start.sh old mode 100644 new mode 100755 From 17f6203d99a45fed780b35ffbb3771b94cd1a850 Mon Sep 17 00:00:00 2001 From: Macleykun Date: Sun, 12 Jun 2022 16:04:21 +0200 Subject: [PATCH 19/21] This should work with exectuable --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e6418c84..69de1ad3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,6 +31,6 @@ RUN ln -s /home/pi/pialert/front /var/www/html/pialert \ EXPOSE 20211 # Set up startup script to run two commands, cron and the lighttpd server -RUN chmod +x /home/pi/pialert/dockerfiles/start.sh +# RUN chmod +x /home/pi/pialert/dockerfiles/start.sh CMD ["/home/pi/pialert/dockerfiles/start.sh"] From 90167a73eb31403c5f59fdbdce3fa7eedc8a2dda Mon Sep 17 00:00:00 2001 From: Macleykun Date: Sun, 12 Jun 2022 16:06:59 +0200 Subject: [PATCH 20/21] Finished up first parter --- Dockerfile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 69de1ad3..0ef6c665 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,10 +27,6 @@ RUN ln -s /home/pi/pialert/front /var/www/html/pialert \ && sed -ie 's/= 80/= 20211/g' /etc/lighttpd/lighttpd.conf \ && service lighttpd restart -# Expose the below port EXPOSE 20211 -# Set up startup script to run two commands, cron and the lighttpd server -# RUN chmod +x /home/pi/pialert/dockerfiles/start.sh - -CMD ["/home/pi/pialert/dockerfiles/start.sh"] +CMD ["/home/pi/pialert/dockerfiles/start.sh"] \ No newline at end of file From 3f2ad4c37a222e3f24407f22d30f5c2a7780d67c Mon Sep 17 00:00:00 2001 From: Macleykun Date: Sun, 12 Jun 2022 16:08:52 +0200 Subject: [PATCH 21/21] add todos --- Dockerfile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Dockerfile b/Dockerfile index 0ef6c665..7d0bb558 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,8 @@ FROM debian:buster-slim +# Todo, figure out why using a workdir instead of full paths don't work +# Todo, do we still need all these packages? I can already see sudo which isn't needed + RUN apt-get update \ && apt-get install --no-install-recommends ca-certificates curl libwww-perl arp-scan perl apt-utils cron sudo lighttpd php php-cgi php-fpm php-sqlite3 sqlite3 dnsutils net-tools python iproute2 -y \ && apt-get clean autoclean \ @@ -13,10 +16,14 @@ RUN mv /var/www/html/index.lighttpd.html /var/www/html/index.lighttpd.html.old \ COPY . /home/pi/pialert +# Todo, is this tar part still needed? + # delete .git/ files and the tar/ realese directory to make the image smaller #RUN rm -r /home/pi/pialert/.git \ RUN rm -r /home/pi/pialert/tar +# Todo, do we need to restart lighthttpd? + # Pi.Alert RUN ln -s /home/pi/pialert/front /var/www/html/pialert \ && python /home/pi/pialert/back/pialert.py update_vendors \ @@ -29,4 +36,6 @@ RUN ln -s /home/pi/pialert/front /var/www/html/pialert \ EXPOSE 20211 +# Todo, can we just use CMD and ENTRYPOINT instead of a script? + CMD ["/home/pi/pialert/dockerfiles/start.sh"] \ No newline at end of file