diff options
author | nachoparker <nacho@ownyourbits.com> | 2019-05-11 21:13:19 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2019-05-13 06:31:38 +0300 |
commit | 3b36dd37527076a56c9812c1cfb0950093ce1d19 (patch) | |
tree | cc8f337d5f74a1db033d3a324038c42fc301b6d7 /docker/lamp | |
parent | d9384817c2a14f0889d30bebb89e40a6cb78217c (diff) |
build: refactor docker builds
Signed-off-by: nachoparker <nacho@ownyourbits.com>
Diffstat (limited to 'docker/lamp')
-rwxr-xr-x | docker/lamp/010lamp | 42 | ||||
-rw-r--r-- | docker/lamp/Dockerfile | 12 |
2 files changed, 50 insertions, 4 deletions
diff --git a/docker/lamp/010lamp b/docker/lamp/010lamp new file mode 100755 index 00000000..5bb2dbaa --- /dev/null +++ b/docker/lamp/010lamp @@ -0,0 +1,42 @@ +#!/bin/bash + +source /usr/local/etc/library.sh + +PHPVER=7.2 + +set -e + +[[ "$1" == "stop" ]] && { + echo "Stopping apache" + apachectl graceful-stop + echo "Stopping PHP-fpm" + pkill -f php-fpm + echo "Stopping mariaDB" + mysqladmin -u root shutdown + echo "LAMP cleanup complete" + exit 0 +} + +# MOVE CONFIGS TO PERSISTENT VOLUME +persistent_cfg /etc/apache2 + +echo "Starting PHP-fpm" +php-fpm${PHPVER} + +echo "Starting Apache" +/usr/sbin/apache2ctl start + +# adjust the dbdir to the persistent storage +sed -i "s|^datadir.*|datadir = /data/database|" /etc/mysql/mariadb.conf.d/90-ncp.cnf + +# start +echo "Starting mariaDB" +mysqld & + +# wait for mariadb +while :; do + [[ -S /var/run/mysqld/mysqld.sock ]] && break + sleep 0.5 +done + +exit 0 diff --git a/docker/lamp/Dockerfile b/docker/lamp/Dockerfile index b92b1435..c0b9276f 100644 --- a/docker/lamp/Dockerfile +++ b/docker/lamp/Dockerfile @@ -1,6 +1,10 @@ -FROM ownyourbits/debian-ncp-x86 +# syntax=docker/dockerfile:experimental -MAINTAINER Ignacio Núñez Hernanz <nacho@ownyourbits.com> +ARG arch=armhf + +FROM ownyourbits/debian-ncp-${arch} + +LABEL maintainer="Ignacio Núñez Hernanz <nacho@ownyourbits.com>" SHELL ["/bin/bash", "-c"] @@ -8,7 +12,7 @@ ENV DOCKERBUILD 1 COPY etc/library.sh lamp.sh /usr/local/etc/ -RUN \ +RUN --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/apt \ # installation source /usr/local/etc/library.sh; \ @@ -36,7 +40,7 @@ rm -f /var/log/alternatives.log /var/log/apt/*; \ rm /data-ro/database/ib_logfile*; \ rm /usr/local/etc/lamp.sh -COPY docker-common/lamp/010lamp /etc/services-enabled.d/ +COPY docker/lamp/010lamp /etc/services-enabled.d/ ENTRYPOINT ["/run-parts.sh"] |