mirror of
https://github.com/pi-hole/docker-pi-hole.git
synced 2024-06-20 06:26:38 +02:00
Merge pull request #38 from diginc/arm_build
docker hub compatible ARM build
This commit is contained in:
commit
e500aba834
65
debian-armhf.docker
Normal file
65
debian-armhf.docker
Normal file
|
@ -0,0 +1,65 @@
|
|||
FROM jsurf/rpi-raspbian
|
||||
MAINTAINER adam@diginc.us <adam@diginc.us>
|
||||
|
||||
RUN [ "cross-build-start" ]
|
||||
|
||||
# Requirements
|
||||
RUN apt-get -q update && \
|
||||
apt-get install -y \
|
||||
dnsmasq \
|
||||
lighttpd \
|
||||
php5-common php5-cgi php5 \
|
||||
bc curl unzip wget sudo && \
|
||||
rm -rf /var/cache/apt/archives
|
||||
|
||||
# Original upstream pihole code being used
|
||||
COPY ./pi-hole/gravity.sh /usr/local/bin/
|
||||
COPY ./pi-hole/adlists.default /etc/pihole/
|
||||
COPY ./pi-hole/adlists.default /etc/.pihole/
|
||||
COPY ./pi-hole/pihole /usr/local/bin/
|
||||
COPY ./pi-hole/advanced/Scripts/* /usr/local/bin/
|
||||
RUN mkdir -p /opt/ && ln -s /usr/local/bin /opt/pihole
|
||||
COPY ./pi-hole/advanced/lighttpd.conf.debian /etc/lighttpd/lighttpd.conf
|
||||
COPY ./pi-hole/advanced/dnsmasq.conf.original /etc/dnsmasq.conf
|
||||
COPY ./pi-hole/advanced/01-pihole.conf /etc/dnsmasq.d/
|
||||
COPY ./pi-hole/advanced/index* /var/www/html/pihole/
|
||||
RUN rm /var/www/html/index.lighttpd.html
|
||||
COPY ./pi-hole/advanced/pihole.sudo /etc/sudoers.d/pihole
|
||||
COPY ./AdminLTE /var/www/html/admin
|
||||
COPY ./AdminLTE_version.txt /etc/
|
||||
COPY ./pi-hole_version.txt /etc/
|
||||
|
||||
ENV WEBLOGDIR /var/log/lighttpd
|
||||
RUN mkdir -p /etc/pihole/ && \
|
||||
mkdir -p /var/www/html/pihole && \
|
||||
mkdir -p /var/www/html/admin/ && \
|
||||
chown www-data:www-data /var/www/html && \
|
||||
touch ${WEBLOGDIR}/access.log ${WEBLOGDIR}/error.log && \
|
||||
chown -R www-data.www-data ${WEBLOGDIR} && \
|
||||
chmod 775 /var/www/html && \
|
||||
lighty-enable-mod fastcgi fastcgi-php || true && \
|
||||
touch /var/log/pihole.log && \
|
||||
chmod 644 /var/log/pihole.log && \
|
||||
chown dnsmasq:root /var/log/pihole.log && \
|
||||
sed -i "s/@INT@/eth0/" /etc/dnsmasq.d/01-pihole.conf && \
|
||||
sed -i 's|"cd /etc/.pihole/ && git describe --tags --abbrev=0"|"cat /etc/pi-hole_version.txt"|g' /var/www/html/admin/footer.php && \
|
||||
sed -i 's|"git describe --tags --abbrev=0"|"cat /etc/AdminLTE_version.txt"|g' /var/www/html/admin/footer.php
|
||||
|
||||
# This chould be eliminated if all (upstream) files were +x in git
|
||||
RUN chmod +x /usr/local/bin/*.sh
|
||||
|
||||
# Fix dnsmasq in docker
|
||||
RUN grep -q '^user=root' || echo 'user=root' >> /etc/dnsmasq.conf
|
||||
|
||||
# php config start passes special ENVs into
|
||||
ENV PHP_ENV_CONFIG '/etc/lighttpd/conf-enabled/15-fastcgi-php.conf'
|
||||
ENV PHP_ERROR_LOG '/var/log/lighttpd/error.log'
|
||||
COPY ./debian-armhf/start.sh /
|
||||
|
||||
EXPOSE 53 53/udp
|
||||
EXPOSE 80
|
||||
|
||||
ENTRYPOINT [ "bash", "-c" ]
|
||||
CMD [ "/start.sh" ]
|
||||
|
||||
RUN [ "cross-build-end" ]
|
38
debian-armhf/start.sh
Executable file
38
debian-armhf/start.sh
Executable file
|
@ -0,0 +1,38 @@
|
|||
#!/bin/sh
|
||||
if [ -z "$ServerIP" ] ; then
|
||||
echo "ERROR: To function correctly you must pass an environment variables of 'ServerIP' into the docker container with the IP of your docker host from which you are passing web (80) and dns (53) ports from"
|
||||
exit 1
|
||||
fi;
|
||||
|
||||
# /tmp/piholeIP is the current override of auto-lookup in gravity.sh
|
||||
echo "$ServerIP" > /etc/pihole/piholeIP;
|
||||
sed -i "/bin-environment/ a\\\t\t\t\"ServerIP\" => \"${ServerIP}\"," $PHP_ENV_CONFIG
|
||||
sed -i "/bin-environment/ a\\\t\t\t\"PHP_ERROR_LOG\" => \"${PHP_ERROR_LOG}\"," $PHP_ENV_CONFIG
|
||||
|
||||
if [ -n "$VIRTUAL_HOST" ] ; then
|
||||
sed -i "/bin-environment/ a\\\t\t\t\"VIRTUAL_HOST\" => \"${VIRTUAL_HOST}\"," $PHP_ENV_CONFIG
|
||||
else
|
||||
sed -i "/bin-environment/ a\\\t\t\t\"VIRTUAL_HOST\" => \"${ServerIP}\"," $PHP_ENV_CONFIG
|
||||
fi;
|
||||
|
||||
echo "Added ENV to php:"
|
||||
grep -E '(VIRTUAL_HOST|ServerIP)' $PHP_ENV_CONFIG
|
||||
|
||||
dnsType='default'
|
||||
DNS1=${DNS1:-'8.8.8.8'}
|
||||
DNS2=${DNS2:-'8.8.4.4'}
|
||||
if [ "$DNS1" != '8.8.8.8' ] || [ "$DNS2" != '8.8.4.4' ] ; then
|
||||
dnsType='custom'
|
||||
fi;
|
||||
|
||||
echo "Using $dnsType DNS servers: $DNS1 & $DNS2"
|
||||
sed -i "s/@DNS1@/$DNS1/" /etc/dnsmasq.d/01-pihole.conf && \
|
||||
sed -i "s/@DNS2@/$DNS2/" /etc/dnsmasq.d/01-pihole.conf && \
|
||||
|
||||
dnsmasq --test -7 /etc/dnsmasq.d || exit 1
|
||||
lighttpd -t -f /etc/lighttpd/lighttpd.conf || exit 1
|
||||
|
||||
gravity.sh # dnsmasq start included
|
||||
service lighttpd start
|
||||
|
||||
tail -F /var/log/lighttpd/*.log /var/log/pihole.log
|
|
@ -9,6 +9,7 @@ run_local = testinfra.get_backend(
|
|||
@pytest.mark.parametrize("image,tag", [
|
||||
( 'alpine.docker', 'diginc/pi-hole:alpine' ),
|
||||
( 'debian.docker', 'diginc/pi-hole:debian' ),
|
||||
( 'debian-armhf.docker', 'diginc/pi-hole-armhf:debian' ),
|
||||
])
|
||||
def test_build_pihole_image(image, tag):
|
||||
build_cmd = run_local('docker build -f {} -t {} .'.format(image, tag))
|
||||
|
|
Loading…
Reference in New Issue
Block a user