diff --git a/pluie/alpine-apache/.gitignore b/pluie/alpine-apache/.gitignore new file mode 100644 index 0000000..ee50cfe --- /dev/null +++ b/pluie/alpine-apache/.gitignore @@ -0,0 +1 @@ +files.tar diff --git a/pluie/alpine-apache/Dockerfile b/pluie/alpine-apache/Dockerfile new file mode 100644 index 0000000..c7293bf --- /dev/null +++ b/pluie/alpine-apache/Dockerfile @@ -0,0 +1,13 @@ +FROM pluie/alpine + +MAINTAINER a-Sansara https://github.com/a-sansara + +ADD files.tar /scripts + +RUN bash /scripts/install.sh + +ENV SHENV_NAME=Apache SHENV_COLOR=67 HTTP_SERVER_NAME=docker-site.dev FIX_OWNERSHIP=1 + +EXPOSE 80 + +VOLUME /app diff --git a/pluie/alpine-apache/build b/pluie/alpine-apache/build new file mode 100755 index 0000000..9d6370a --- /dev/null +++ b/pluie/alpine-apache/build @@ -0,0 +1,21 @@ +#!/bin/bash +# pluie/docker-images - a-Sansara (https://github.com/a-sansara) + + Ctitle="\033[1;38;5;15;1;48;5;30m" + Citem="\033[1;38;5;36m" + Coff="\033[m" + DOCKDIR=$(dirname "$(readlink -f ${BASH_SOURCE[0]})") +DOCKBUILD=$(basename $DOCKDIR) + DOCKREPO=$(basename $(dirname $DOCKDIR)) + DOCKTAG=${1:-"latest"} + TMPPWD=$(pwd) + indent=" " +cd $DOCKDIR +echo -e "\n ${Ctitle} Preparing files : ${Coff}${Citem}\n" + +tar -cvf files.tar *.sh pre-init.d/ install.d/ | sed "s/^/${indent}* /" + +echo -e "\n ${Ctitle} Proceed Dockerfile build : ${Coff}\n +" +docker build --force-rm -t ${DOCKREPO}/${DOCKBUILD}:${DOCKTAG} . | sed "s/^/${indent}/" +cd $TMPPWD diff --git a/pluie/alpine-apache/install.d/10-apache.sh b/pluie/alpine-apache/install.d/10-apache.sh new file mode 100755 index 0000000..0e4713d --- /dev/null +++ b/pluie/alpine-apache/install.d/10-apache.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# pluie/docker-images - a-Sansara (https://github.com/a-sansara) + +apk --update add apache2 \ +php-apache2 php-cli php-phar php-zlib php-zip php-ctype php-mysqli php-pdo_mysql php-xml \ +php-opcache php-pdo php-json php-curl php-gd php-mcrypt php-openssl \ +# php-pdo_odbc php-soap php-pgsql diff --git a/pluie/alpine-apache/install.d/50-fix-apache.sh b/pluie/alpine-apache/install.d/50-fix-apache.sh new file mode 100755 index 0000000..77f3318 --- /dev/null +++ b/pluie/alpine-apache/install.d/50-fix-apache.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# pluie/docker-images - a-Sansara (https://github.com/a-sansara) + +mkdir -p /app/www +chown -R 1000:apache /app/www +chmod -R 755 /scripts/pre-init.d +sed -i 's#^DocumentRoot ".*#DocumentRoot "/app/www"#g' /etc/apache2/httpd.conf +sed -i 's#AllowOverride none#AllowOverride All#' /etc/apache2/httpd.conf +sed -ir 's/expose_php = On/expose_php = Off/' /etc/php/php.ini +echo -e "\nIncludeOptional /app/vhost" >> /etc/apache2/httpd.conf diff --git a/pluie/alpine-apache/main.sh b/pluie/alpine-apache/main.sh new file mode 100755 index 0000000..15e9a49 --- /dev/null +++ b/pluie/alpine-apache/main.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# pluie/docker-images - a-Sansara (https://github.com/a-sansara) + +. /scripts/common.sh + +echo "[[ Starting Apache Daemon ]]" +httpd -D FOREGROUND diff --git a/pluie/alpine-apache/pre-init.d/10-apache.sh b/pluie/alpine-apache/pre-init.d/10-apache.sh new file mode 100755 index 0000000..c3829ff --- /dev/null +++ b/pluie/alpine-apache/pre-init.d/10-apache.sh @@ -0,0 +1,10 @@ +#!/usr/bin/bash +# pluie/docker-images - a-Sansara (https://github.com/a-sansara) + +if [ ! -z "$FIX_OWNERSHIP" ] && [ "$FIX_OWNERSHIP" -eq 1 ]; then + chown -R 1000:apache /app/www +fi + +touch /var/log/apache2/error.log + +tail -F /var/log/apache2/error.log & diff --git a/pluie/alpine-apache/pre-init.d/10-vhost.sh b/pluie/alpine-apache/pre-init.d/10-vhost.sh new file mode 100755 index 0000000..e338c80 --- /dev/null +++ b/pluie/alpine-apache/pre-init.d/10-vhost.sh @@ -0,0 +1,22 @@ +#!/usr/bin/bash +# pluie/docker-images - a-Sansara (https://github.com/a-sansara) + +if [ ! -z "/app/vhost" ]; then + cat < "/app/vhost" + + ServerName $HTTP_SERVER_NAME + + AllowOverride None + Allow from all + DirectoryIndex index.php + + Options -MultiViews +FollowSymlinks + RewriteEngine On + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^ index.php [QSA,L] + + + +# IncludeOptional /app/vhost2 +EOF +fi diff --git a/pluie/alpine/install.d/10-ps1.sh b/pluie/alpine/install.d/10-ps1.sh index 9eb4519..0984189 100644 --- a/pluie/alpine/install.d/10-ps1.sh +++ b/pluie/alpine/install.d/10-ps1.sh @@ -1,18 +1,12 @@ #!/bin/bash # pluie/docker-images - a-Sansara (https://github.com/a-sansara) -echo "ps1" -if [ ! -f /root/.bash_ps1 ]; then - echo "existe pas" -else - echo "existe" -fi + if [ ! -f /root/.bash_ps1 ]; then cat <> /root/.bashrc if [ -f ~/.bash_ps1 ]; then . ~/.bash_ps1 fi EOF - sed -n '1,22 p' /scripts/util.sh > /root/.bash_ps1 echo "bash_prompt" >> /root/.bash_ps1 fi