From 5cb32932c59410ddf8846bd94ae09817042adff3 Mon Sep 17 00:00:00 2001 From: sylvain Date: Thu, 15 May 2025 19:23:06 +0000 Subject: [PATCH 1/5] Supprimer dockerfile --- dockerfile | 66 ------------------------------------------------------ 1 file changed, 66 deletions(-) delete mode 100644 dockerfile diff --git a/dockerfile b/dockerfile deleted file mode 100644 index 6569fa2..0000000 --- a/dockerfile +++ /dev/null @@ -1,66 +0,0 @@ -FROM debian:12 - -ENV DEBIAN_FRONTEND=noninteractive - -ARG DOMAIN -ARG SMTP_EMAIL -ARG SMTP_SERVER -ARG SMTP_PORT -ARG SMTP_USER -ARG SMTP_PASS -ARG ADMIN_EMAIL - -# Installer les paquets nécessaires -RUN apt-get update && apt-get install -y \ - apache2 \ - php php-cli php-mysql php-curl php-fpm php-gd php-json php-xml php-zip php-mbstring php-bcmath php-gmp php-intl \ - software-properties-common git msmtp mariadb-client cron curl unzip nano - -# Nettoyer -RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -# Copier et activer la config Apache (HTTP uniquement) -COPY src/container_apache.conf /etc/apache2/sites-available/${DOMAIN}.conf -RUN sed -i "s/{{DOMAIN}}/${DOMAIN}/g" /etc/apache2/sites-available/${DOMAIN}.conf && \ - a2dissite 000-default.conf && \ - a2ensite ${DOMAIN}.conf && \ - a2enmod rewrite - -# Installer Hubzilla -RUN git clone https://framagit.org/hubzilla/core.git /var/www/html && \ - /bin/bash -c "cd /var/www/html && ./util/add_addon_repo https://framagit.org/hubzilla/addons.git official" && \ - mkdir -p /var/www/html/store/[data]/smarty3 && \ - chown -R www-data:www-data /var/www/html - - -# Configurer msmtp -COPY src/msmtprc /etc/msmtprc -RUN sed -i "s/{{SMTP_EMAIL}}/${SMTP_EMAIL}/g" /etc/msmtprc && \ - sed -i "s/{{SMTP_SERVER}}/${SMTP_SERVER}/g" /etc/msmtprc && \ - sed -i "s/{{SMTP_PORT}}/${SMTP_PORT}/g" /etc/msmtprc && \ - sed -i "s/{{SMTP_USER}}/${SMTP_USER}/g" /etc/msmtprc && \ - sed -i "s/{{SMTP_PASS}}/${SMTP_PASS}/g" /etc/msmtprc && \ - chmod 600 /etc/msmtprc && \ - chown www-data:www-data /etc/msmtprc - -# Activer msmtp dans PHP -RUN echo "sendmail_path = /usr/bin/msmtp -t" >> /etc/php/8.2/apache2/php.ini - -# Config PHP (upload size + register_argc_argv) -RUN echo "upload_max_filesize = 20M" >> /etc/php/8.2/apache2/php.ini && \ - echo "post_max_size = 20M" >> /etc/php/8.2/apache2/php.ini && \ - echo "register_argc_argv = On" >> /etc/php/8.2/apache2/php.ini - -# Fichier .htconfig.php (préconfiguré) -COPY src/.htconfig.php /tmp/.htconfig.php -RUN LOCATION_HASH=$(cat /dev/urandom | tr -dc 'a-f0-9' | fold -w 64 | head -n 1) && \ - sed "s/{{DOMAIN}}/${DOMAIN}/g; s/{{LOCATION_HASH}}/${LOCATION_HASH}/g; s/{{ADMIN_EMAIL}}/${ADMIN_EMAIL}/g" /tmp/.htconfig.php > /var/www/html/.htconfig.php && \ - chown www-data:www-data /var/www/html/.htconfig.php - -# Cron -RUN echo "*/15 * * * * cd /var/www/html; /usr/bin/php Zotlabs/Daemon/Master.php Cron" | crontab -u www-data - - -# Script de démarrage -COPY src/start.sh /start.sh -RUN chmod +x /start.sh -CMD ["/bin/bash", "/start.sh"] -- 2.49.1 From 7033b21c881ffaf4c989010118e3b69b700f67a3 Mon Sep 17 00:00:00 2001 From: sylvain Date: Thu, 15 May 2025 19:24:17 +0000 Subject: [PATCH 2/5] Ajouter dockerfile --- dockerfile | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 dockerfile diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..ca74807 --- /dev/null +++ b/dockerfile @@ -0,0 +1,52 @@ +FROM debian:12 + +ENV DEBIAN_FRONTEND=noninteractive + +# Installation des dépendances nécessaires +RUN apt-get update && apt-get install -y \ + apache2 \ + mariadb-client \ + php \ + php-cli \ + php-mysql \ + php-curl \ + php-gd \ + php-json \ + php-xml \ + php-zip \ + php-mbstring \ + php-bcmath \ + php-gmp \ + php-intl \ + git \ + curl \ + unzip \ + nano \ + cron \ + && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Configuration du répertoire de travail +WORKDIR /var/www/html + +# Clonage du dépôt Hubzilla +RUN git clone https://framagit.org/hubzilla/core.git . && \ + mkdir -p store/[data]/smarty3 && \ + chown -R www-data:www-data /var/www/html + +# Activation des modules Apache nécessaires +RUN a2enmod rewrite ssl + +# Configuration de PHP +RUN echo "upload_max_filesize = 20M" >> /etc/php/8.2/apache2/php.ini && \ + echo "post_max_size = 20M" >> /etc/php/8.2/apache2/php.ini && \ + echo "register_argc_argv = On" >> /etc/php/8.2/apache2/php.ini + +# Configuration du site Apache +COPY src/hubzilla.conf /etc/apache2/sites-available/hubzilla.conf +RUN a2dissite 000-default.conf && a2ensite hubzilla.conf + +# Copie du script de démarrage +COPY src/start.sh /start.sh +RUN chmod +x /start.sh + +CMD ["/bin/bash", "/start.sh"] -- 2.49.1 From a53dff8f464f833a1617695d5d1bd518cbc3864c Mon Sep 17 00:00:00 2001 From: sylvain Date: Thu, 15 May 2025 19:25:43 +0000 Subject: [PATCH 3/5] Actualiser src/container_apache.conf --- src/container_apache.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/container_apache.conf b/src/container_apache.conf index 42318e2..a3e3ed3 100644 --- a/src/container_apache.conf +++ b/src/container_apache.conf @@ -1,5 +1,5 @@ - ServerName {{DOMAIN}} + ServerName yourdomain.com DocumentRoot /var/www/html @@ -7,6 +7,6 @@ Require all granted - ErrorLog ${APACHE_LOG_DIR}/hubzilla_error.log - CustomLog ${APACHE_LOG_DIR}/hubzilla_access.log combined + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined \ No newline at end of file -- 2.49.1 From 8303f92ee330bb9155f6f896d22336d53998fa7f Mon Sep 17 00:00:00 2001 From: sylvain Date: Thu, 15 May 2025 19:29:13 +0000 Subject: [PATCH 4/5] Actualiser src/start.sh --- src/start.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/start.sh b/src/start.sh index e3c8b18..98cd5ec 100755 --- a/src/start.sh +++ b/src/start.sh @@ -1,7 +1,7 @@ #!/bin/bash -echo "[INFO] Lancement du service cron..." -service cron start +# Démarrage du service Apache +service apache2 start -echo "[INFO] Lancement du serveur Apache..." -apachectl -D FOREGROUND +# Attente indéfinie pour maintenir le conteneur en cours d'exécution +tail -f /dev/null \ No newline at end of file -- 2.49.1 From af92eb6c18aef54164b4abd769f8c0da24979ea1 Mon Sep 17 00:00:00 2001 From: sylvain Date: Fri, 16 May 2025 21:42:18 +0200 Subject: [PATCH 5/5] marche --- dockerfile | 1 + src/hubzilla.conf | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 src/hubzilla.conf diff --git a/dockerfile b/dockerfile index ca74807..71560ec 100644 --- a/dockerfile +++ b/dockerfile @@ -29,6 +29,7 @@ RUN apt-get update && apt-get install -y \ WORKDIR /var/www/html # Clonage du dépôt Hubzilla +RUN rm -r /var/www/html/ RUN git clone https://framagit.org/hubzilla/core.git . && \ mkdir -p store/[data]/smarty3 && \ chown -R www-data:www-data /var/www/html diff --git a/src/hubzilla.conf b/src/hubzilla.conf new file mode 100644 index 0000000..f22afa5 --- /dev/null +++ b/src/hubzilla.conf @@ -0,0 +1,12 @@ + + ServerName yourdomain.com + DocumentRoot /var/www/html + + + AllowOverride All + Require all granted + + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + -- 2.49.1