diff --git a/misc/images/nineapache82/containers/nineapache/Dockerfile b/misc/images/nineapache82/containers/nineapache/Dockerfile index a580ed3..bfb2726 100755 --- a/misc/images/nineapache82/containers/nineapache/Dockerfile +++ b/misc/images/nineapache82/containers/nineapache/Dockerfile @@ -65,14 +65,26 @@ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local RUN npm install -g n RUN npm install -g yarn -RUN mkdir /etc/supervisor.d +# Configurer les permissions pour Apache et PHP +RUN mkdir -p /etc/supervisor.d && \ + mkdir -p /app/public && \ + mkdir -p /etc/apache2/conf.d/nine && \ + mkdir -p /var/log/apache2 && \ + mkdir -p /run/apache2 && \ + chown -R apache:apache /var/log/apache2 /etc/apache2 /app /etc/ssl/apache2 /run/apache2 + +# Copier les fichiers de configuration COPY apache2.sh /etc/apache2/apache2.sh -RUN chmod +x /etc/apache2/apache2.sh COPY php.local.ini /etc/php82/conf.d/ COPY httpd.conf /etc/apache2/httpd.conf COPY site.conf /etc/apache2/conf.d/nine/site.conf COPY ssl.conf /etc/apache2/conf.d/ssl.conf COPY index.php /app/public/index.php +# Donner les droits d'exécution au script +RUN chmod +x /etc/apache2/apache2.sh + +# Commande de démarrage +USER apache CMD ["/etc/apache2/apache2.sh"] \ No newline at end of file diff --git a/misc/images/nineapache82/containers/nineapache/apache2.sh b/misc/images/nineapache82/containers/nineapache/apache2.sh index 8f72e50..4f5b014 100644 --- a/misc/images/nineapache82/containers/nineapache/apache2.sh +++ b/misc/images/nineapache82/containers/nineapache/apache2.sh @@ -3,25 +3,29 @@ envfile=/etc/apache2/conf.d/env.conf haveenv=/etc/apache2/haveenv.txt -rm -rf $envfile -rm -rf $haveenv - -echo "GENERATION DES VARIABLES D'ENVIRONNEMENT" -printf "\n# Expose environment variables to scripts.\nPassEnv" >> $envfile -compgen -e | while read name ; do - if [[ "$name" != "TERM" && "$name" != "HOME" && "$name" != "HOSTNAME" && "$name" != "PATH" && "$name" != "PWD" && "$name" != "SHLVL" ]] - then - touch $haveenv - printf " $name" >> $envfile - fi -done -printf "\n" >> $envfile - -if [[ ! -f $haveenv ]] -then +# Vérification de la permission d'écriture +if touch "$envfile" &>/dev/null; then + echo "GENERATION DES VARIABLES D'ENVIRONNEMENT" rm -rf $envfile + rm -rf $haveenv + + printf "\n# Expose environment variables to scripts.\nPassEnv" >> $envfile + compgen -e | while read name ; do + if [[ "$name" != "TERM" && "$name" != "HOME" && "$name" != "HOSTNAME" && "$name" != "PATH" && "$name" != "PWD" && "$name" != "SHLVL" ]] + then + touch $haveenv + printf " $name" >> $envfile + fi + done + printf "\n" >> $envfile + + if [[ ! -f $haveenv ]] + then + rm -rf $envfile + fi + rm -rf $haveenv fi -rm -rf $haveenv echo "START HTTPD" httpd -DFOREGROUND + diff --git a/misc/images/nineapache82/docker-compose.yml b/misc/images/nineapache82/docker-compose.yml index a30f884..e9aa0b7 100755 --- a/misc/images/nineapache82/docker-compose.yml +++ b/misc/images/nineapache82/docker-compose.yml @@ -7,5 +7,5 @@ services: image: reg.cadoles.com/envole/nineapache:8.2 container_name: nineapache82 ports: - - "8080:80" + - "8081:80" - "8443:443" \ No newline at end of file