nineapache82 as noroot

This commit is contained in:
afornerot 2025-01-04 10:59:24 +01:00
parent a6bed85c2d
commit c14b74590d
3 changed files with 36 additions and 20 deletions

View File

@ -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"]

View File

@ -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

View File

@ -7,5 +7,5 @@ services:
image: reg.cadoles.com/envole/nineapache:8.2
container_name: nineapache82
ports:
- "8080:80"
- "8081:80"
- "8443:443"