base off php7 docker

This commit is contained in:
Daniel Wolf 2018-05-15 18:37:05 -04:00
parent b5671a166f
commit e1c13393e5
6 changed files with 13 additions and 95 deletions

View File

@ -1,4 +1,4 @@
FROM nephatrine/nginx-lemp:latest
FROM nephatrine/base-php7:latest
LABEL maintainer="Daniel Wolf <nephatrine@gmail.com>"
RUN echo "====== NOT MUCH TO DO ======" \
@ -14,7 +14,12 @@ RUN echo "====== NOT MUCH TO DO ======" \
&& git clone https://github.com/lrsjng/h5ai.git && cd h5ai \
&& npm install && npm run build \
&& unzip build/*.zip -d /var/www/html/ \
&& sed -i 's/index.html/index.html \/_h5ai\/public\/index.php/g' /etc/nginx/nginx.conf \
\
&& echo "====== CONFIGURE NGINX ======" \
&& sed -i 's~index.html~index.html /_h5ai/public/index.php~g' /etc/nginx/nginx.conf \
\
&& echo "====== CONFIGURE PHP ======" \
&& sed -i 's~/mnt/config/www/~/mnt/config/www/:/mnt/media/~g' /etc/php/php-fpm.d/www.conf \
\
&& echo "====== CLEANUP ======" \
&& cd /usr/src \

View File

@ -1,11 +0,0 @@
#!/usr/bin/with-contenv bash
if [[ -d /etc/services.d/10-mysqld ]]; then
rm -rf /etc/services.d/10-mysqld
fi
if [[ -d /etc/services.d/11-mysql-setup ]]; then
rm -rf /etc/services.d/11-mysql-setup
fi
echo 'Skipping. MariaDB not needed.'

View File

@ -1,54 +0,0 @@
#!/usr/bin/with-contenv bash
DNSADDR=${DNSADDR:-"8.8.8.8 8.8.4.4"}
SSLPRIMARY=`echo $SSLDOMAINS | tr ',' ' ' | awk '{print $1}'`
THISIP=`ifconfig eth0 | grep 'inet addr' | tr ':' ' ' | awk '{print $3}'`
THISSN=`ifconfig eth0 | grep 'inet addr' | tr ':' ' ' | awk '{print $7}'`
TRSTIP=`ipcalc -n $THISIP $THISSN | tr '=' ' ' | awk '{print $2}'`
TRSTPF=`ipcalc -p $THISIP $THISSN | tr '=' ' ' | awk '{print $2}'`
if [[ ! -f /mnt/config/etc/mime.types ]]; then
s6-setuidgid guardian cp /etc/nginx/mime.types /mnt/config/etc/mime.types
fi
if [[ ! -f /mnt/config/etc/nginx.conf ]]; then
if [[ ! -z "${SSLPRIMARY}" ]]; then
sed -e "s/8.8.8.8 8.8.4.4/${DNSADDR}/g" /etc/nginx/nginx.conf | sed -e 's/#SSL://g' | sed -e 's/#NOSSL:/#/g' | s6-setuidgid guardian tee /mnt/config/etc/nginx.conf | grep -v ""
else
sed -e "s/8.8.8.8 8.8.4.4/${DNSADDR}/g" /etc/nginx/nginx.conf | sed -e 's/#NOSSL://g' | sed -e 's/#SSL:/#/g' | s6-setuidgid guardian tee /mnt/config/etc/nginx.conf | grep -v ""
fi
if ! grep -q 'REPLACE_WITH_TRUSTED_PROXY_SUBNET' /etc/nginx/nginx.d/default.conf; then
s6-setuidgid guardian sed -i -e 's/#NOPROXY:/#/g' /mnt/config/etc/nginx.conf
s6-setuidgid guardian sed -i -e 's/#PROXY://g' /mnt/config/etc/nginx.conf
else
s6-setuidgid guardian sed -i -e 's/#NOPROXY://g' /mnt/config/etc/nginx.conf
s6-setuidgid guardian sed -i -e 's/#PROXY:/#/g' /mnt/config/etc/nginx.conf
fi
fi
if [[ ! -d /mnt/config/etc/nginx.d ]]; then
s6-setuidgid guardian mkdir -p /mnt/config/etc/nginx.d
if [[ ! -z "${SSLPRIMARY}" ]]; then
sed -e "s/REPLACE_WITH_DOMAIN_NAME/${SSLPRIMARY}/g" /etc/nginx/nginx.d/default.conf | sed -e 's/#SSL://g' | sed -e 's/#NOSSL:/#/g' | s6-setuidgid guardian tee /mnt/config/etc/nginx.d/default.conf | grep -v ""
else
sed -e 's/#NOSSL://g' /etc/nginx/nginx.d/default.conf | sed -e 's/#SSL:/#/g' | s6-setuidgid guardian tee /mnt/config/etc/nginx.d/default.conf | grep -v ""
fi
s6-setuidgid guardian sed -i -e "s/REPLACE_WITH_TRUSTED_PROXY_SUBNET/${TRSTIP}\/${TRSTPF}/g" /mnt/config/etc/nginx.d/default.conf
s6-setuidgid guardian cp -n /etc/nginx/nginx.d/* /mnt/config/etc/nginx.d/
fi
if [[ ! -z "${SSLPRIMARY}" ]]; then
if [[ ! -d /mnt/config/ssl ]]; then
s6-setuidgid guardian mkdir -p /mnt/config/ssl
fi
if [[ ! -f /mnt/config/ssl/dhparam.pem ]]; then
s6-setuidgid guardian openssl dhparam -out /mnt/config/ssl/dhparam.pem 4096
fi
fi
if [[ ! -d /mnt/media/_h5ai ]]; then
s6-setuidgid guardian mkdir -p /mnt/media/_h5ai
s6-setuidgid guardian cp -Rn /var/www/html/_h5ai/* /mnt/media/_h5ai/
fi

View File

@ -1,3 +0,0 @@
#!/usr/bin/with-contenv bash
echo 'Skipping. Adminer not needed.'

View File

@ -0,0 +1,6 @@
#!/usr/bin/with-contenv bash
if [[ ! -d /mnt/media/_h5ai ]]; then
s6-setuidgid guardian mkdir -p /mnt/media/_h5ai
s6-setuidgid guardian cp -Rn /var/www/html/_h5ai/* /mnt/media/_h5ai/
fi

View File

@ -1,25 +0,0 @@
[www]
user = guardian
group = users
listen = /var/run/php-fpm/php-fpm.sock
listen.backlog = -1
listen.owner = guardian
listen.group = users
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max_requests = 1024
access.log = /mnt/config/log/php-fpm-access.log
slowlog = /mnt/config/log/php-fpm-slow.log
request_slowlog_timeout = 5s
request_terminate_timeout = 120s
rlimit_files = 8192
catch_workers_output = yes
env[HOSTNAME] = $HOSTNAME
env[PATH] = /mnt/config/bin:/usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
php_admin_value[open_basedir] = /mnt/media/:/tmp/