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 n
RUN npm install -g yarn 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 COPY apache2.sh /etc/apache2/apache2.sh
RUN chmod +x /etc/apache2/apache2.sh
COPY php.local.ini /etc/php82/conf.d/ COPY php.local.ini /etc/php82/conf.d/
COPY httpd.conf /etc/apache2/httpd.conf COPY httpd.conf /etc/apache2/httpd.conf
COPY site.conf /etc/apache2/conf.d/nine/site.conf COPY site.conf /etc/apache2/conf.d/nine/site.conf
COPY ssl.conf /etc/apache2/conf.d/ssl.conf COPY ssl.conf /etc/apache2/conf.d/ssl.conf
COPY index.php /app/public/index.php 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"] CMD ["/etc/apache2/apache2.sh"]

View File

@ -3,25 +3,29 @@
envfile=/etc/apache2/conf.d/env.conf envfile=/etc/apache2/conf.d/env.conf
haveenv=/etc/apache2/haveenv.txt haveenv=/etc/apache2/haveenv.txt
rm -rf $envfile # Vérification de la permission d'écriture
rm -rf $haveenv if touch "$envfile" &>/dev/null; then
echo "GENERATION DES VARIABLES D'ENVIRONNEMENT"
rm -rf $envfile
rm -rf $haveenv
echo "GENERATION DES VARIABLES D'ENVIRONNEMENT" printf "\n# Expose environment variables to scripts.\nPassEnv" >> $envfile
printf "\n# Expose environment variables to scripts.\nPassEnv" >> $envfile compgen -e | while read name ; do
compgen -e | while read name ; do
if [[ "$name" != "TERM" && "$name" != "HOME" && "$name" != "HOSTNAME" && "$name" != "PATH" && "$name" != "PWD" && "$name" != "SHLVL" ]] if [[ "$name" != "TERM" && "$name" != "HOME" && "$name" != "HOSTNAME" && "$name" != "PATH" && "$name" != "PWD" && "$name" != "SHLVL" ]]
then then
touch $haveenv touch $haveenv
printf " $name" >> $envfile printf " $name" >> $envfile
fi fi
done done
printf "\n" >> $envfile printf "\n" >> $envfile
if [[ ! -f $haveenv ]] if [[ ! -f $haveenv ]]
then then
rm -rf $envfile rm -rf $envfile
fi
rm -rf $haveenv
fi fi
rm -rf $haveenv
echo "START HTTPD" echo "START HTTPD"
httpd -DFOREGROUND httpd -DFOREGROUND

View File

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