mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
46
Dockerfile
46
Dockerfile
@@ -1,45 +1,41 @@
|
|||||||
FROM debian:buster-slim
|
FROM debian:buster-slim
|
||||||
|
|
||||||
ARG dir="/home/pi/pialert"
|
# 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
|
||||||
|
|
||||||
#Update and reduce image size
|
RUN apt-get update \
|
||||||
RUN apt 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 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 clean autoclean \
|
||||||
#Install without the --no-install-recommends flag
|
&& apt-get autoremove \
|
||||||
&& apt install curl arp-scan -y \
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
#clean-up
|
|
||||||
&& apt clean autoclean \
|
|
||||||
&& apt autoremove
|
|
||||||
|
|
||||||
#add the pi user
|
|
||||||
RUN useradd -ms /bin/bash pi
|
|
||||||
WORKDIR /home/pi
|
|
||||||
|
|
||||||
# Lighttpd & PHP
|
# Lighttpd & PHP
|
||||||
RUN mv /var/www/html/index.lighttpd.html /var/www/html/index.lighttpd.html.old \
|
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
|
&& lighttpd-enable-mod fastcgi-php
|
||||||
|
|
||||||
COPY . $dir
|
COPY . /home/pi/pialert
|
||||||
|
|
||||||
|
# Todo, is this tar part still needed?
|
||||||
|
|
||||||
# delete .git/ files and the tar/ realese directory to make the image smaller
|
# delete .git/ files and the tar/ realese directory to make the image smaller
|
||||||
#RUN rm -r $dir/.git \
|
#RUN rm -r /home/pi/pialert/.git \
|
||||||
RUN rm -r $dir/tar
|
RUN rm -r /home/pi/pialert/tar
|
||||||
|
|
||||||
|
# Todo, do we need to restart lighthttpd?
|
||||||
|
|
||||||
# Pi.Alert
|
# Pi.Alert
|
||||||
RUN ln -s $dir/front /var/www/html/pialert \
|
RUN ln -s /home/pi/pialert/front /var/www/html/pialert \
|
||||||
&& python $dir/back/pialert.py update_vendors \
|
&& python /home/pi/pialert/back/pialert.py update_vendors \
|
||||||
&& (crontab -l 2>/dev/null; cat $dir/install/pialert.cron) | crontab - \
|
&& (crontab -l 2>/dev/null; cat /home/pi/pialert/install/pialert.cron) | crontab - \
|
||||||
&& chgrp -R www-data $dir/db \
|
&& chgrp -R www-data /home/pi/pialert/db \
|
||||||
&& chmod -R 770 $dir/db \
|
&& chmod -R 770 /home/pi/pialert/db \
|
||||||
# changing the default port number 80 to something random, here 20211
|
# changing the default port number 80 to something random, here 20211
|
||||||
&& sed -ie 's/= 80/= 20211/g' /etc/lighttpd/lighttpd.conf \
|
&& sed -ie 's/= 80/= 20211/g' /etc/lighttpd/lighttpd.conf \
|
||||||
&& service lighttpd restart
|
&& service lighttpd restart
|
||||||
|
|
||||||
# Expose the below port
|
|
||||||
EXPOSE 20211
|
EXPOSE 20211
|
||||||
|
|
||||||
# Set up startup script to run two commands, cron and the lighttpd server
|
# Todo, can we just use CMD and ENTRYPOINT instead of a script?
|
||||||
RUN chmod +x $dir/dockerfiles/start.sh
|
|
||||||
|
|
||||||
CMD ["/home/pi/pialert/dockerfiles/start.sh"]
|
CMD ["/home/pi/pialert/dockerfiles/start.sh"]
|
||||||
0
dockerfiles/start.sh
Normal file → Executable file
0
dockerfiles/start.sh
Normal file → Executable file
Reference in New Issue
Block a user