Compare commits

...

20 Commits

Author SHA1 Message Date
af92eb6c18 marche 2025-05-16 21:42:18 +02:00
8303f92ee3 Actualiser src/start.sh 2025-05-15 19:29:13 +00:00
a53dff8f46 Actualiser src/container_apache.conf 2025-05-15 19:25:43 +00:00
7033b21c88 Ajouter dockerfile 2025-05-15 19:24:17 +00:00
5cb32932c5 Supprimer dockerfile 2025-05-15 19:23:06 +00:00
4ff4e74b95 Actualiser dockerfile 2025-05-15 19:18:42 +00:00
4d4ccf465a Actualiser dockerfile 2025-05-15 19:16:44 +00:00
43c722b5d5 Actualiser dockerfile 2025-05-15 19:15:01 +00:00
0af34e3c68 Actualiser dockerfile 2025-05-15 19:10:26 +00:00
bae256f0c9 Ajouter src/.htconfig.php 2025-05-15 19:06:43 +00:00
b9e9d8af22 Actualiser src/container_apache.conf 2025-05-15 19:04:33 +00:00
dfcca6af8f Actualiser dockerfile 2025-05-15 19:03:25 +00:00
95b6f19a4f Actualiser dockerfile 2025-05-15 18:20:24 +00:00
75bcbab3e6 Actualiser src/container_apache.conf 2025-05-15 18:17:48 +00:00
b3e734c3c6 Actualiser dockerfile 2025-05-15 18:12:23 +00:00
6ca4a8796e Actualiser dockerfile 2025-05-15 18:06:35 +00:00
eb2f038f95 Actualiser dockerfile 2025-05-15 18:05:20 +00:00
ee581aa5b5 Actualiser dockerfile 2025-05-15 17:53:49 +00:00
97f4a22ba1 Actualiser dockerfile 2025-05-15 17:42:51 +00:00
180282d208 Supprimer src/.htconfig.php 2025-05-15 17:41:07 +00:00
5 changed files with 61 additions and 66 deletions

View File

@@ -2,60 +2,52 @@ 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
# 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/*
# 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 \
software-properties-common git openssl msmtp mariadb-client cron curl unzip nano
# Configuration du répertoire de travail
WORKDIR /var/www/html
# Nettoyer
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Générer un certificat SSL auto-signé
RUN mkdir -p /etc/ssl/private && mkdir -p /etc/ssl/certs && \
openssl req -x509 -nodes -subj "/C=FR/ST=France/L=Paris/O=organization/OU=Org/CN=${DOMAIN}" \
-newkey rsa:4096 -keyout /etc/ssl/private/${DOMAIN}.key -out /etc/ssl/certs/${DOMAIN}.crt -days 365
# Copier et activer la config Apache
COPY src/container_apache.conf /etc/apache2/sites-available/$DOMAIN.conf
RUN sed -i "s/{{DOMAIN}}/$DOMAIN/g" /etc/apache2/sites-available/$DOMAIN.conf
RUN a2dissite 000-default default-ssl
RUN a2ensite $DOMAIN.conf
RUN a2enmod ssl rewrite
# Installer Hubzilla
# Clonage du dépôt Hubzilla
RUN rm -r /var/www/html/
RUN git clone https://framagit.org/hubzilla/core.git /var/www/html/
RUN cd /var/www/html/ && util/add_addon_repo https://framagit.org/hubzilla/addons.git official
RUN mkdir -p "/var/www/html/store/[data]/smarty3" && \
chown -R www-data:www-data /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
# 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
RUN chmod 600 /etc/msmtprc && chown www-data:www-data /etc/msmtprc
RUN echo "sendmail_path = /usr/bin/msmtp -t" >> /etc/php/8.2/apache2/php.ini
# Activation des modules Apache nécessaires
RUN a2enmod rewrite ssl
# Fichier .htconfig.php
COPY src/.htconfig.php /var/www/html/.htconfig.php
RUN LOCATION_HASH=$(cat /dev/urandom | tr -dc 'a-f0-9' | fold -w 64 | head -n 1) && \
sed -i "s/{{DOMAIN}}/${DOMAIN}/g" /var/www/html/.htconfig.php && \
sed -i "s/{{LOCATION_HASH}}/${LOCATION_HASH}/g" /var/www/html/.htconfig.php && \
sed -i "s/{{ADMIN_EMAIL}}/${ADMIN_EMAIL}/g" /var/www/html/.htconfig.php
# 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
# Cron
RUN echo "*/15 * * * * cd /var/www/html; /usr/bin/php Zotlabs/Daemon/Master.php Cron" | crontab -u www-data -
# Configuration du site Apache
COPY src/hubzilla.conf /etc/apache2/sites-available/hubzilla.conf
RUN a2dissite 000-default.conf && a2ensite hubzilla.conf
# Script de démarrage
# Copie du script de démarrage
COPY src/start.sh /start.sh
RUN chmod +x /start.sh
CMD ["/bin/bash", "/start.sh"]
CMD ["/bin/bash", "/start.sh"]

View File

@@ -6,7 +6,8 @@ define('Z_PATH', dirname(__FILE__));
define('Z_CONFIG', dirname(__FILE__));
define('Z_DATA', 'store');
$db_host = 'db'; // à ajuster si besoin
// Base de données
$db_host = 'db';
$db_port = 3306;
$db_user = 'hubzilla';
$db_pass = 'hubzilla_pass';
@@ -15,7 +16,6 @@ $db_data = 'hubzilla';
$default_timezone = 'Europe/Paris';
$hostname = '{{DOMAIN}}';
$directory = '';
$site_location = 'https://{{DOMAIN}}/';
$admin_email = '{{ADMIN_EMAIL}}';
$site_id = '{{LOCATION_HASH}}';

View File

@@ -1,21 +1,12 @@
<VirtualHost *:80>
ServerName {{DOMAIN}}
Redirect permanent / https://{{DOMAIN}}/
</VirtualHost>
<VirtualHost *:443>
ServerName {{DOMAIN}}
ServerName yourdomain.com
DocumentRoot /var/www/html
<Directory /var/www/html>
AllowOverride All
Require all granted
</Directory>
SSLEngine on
SSLCertificateFile /etc/ssl/certs/{{DOMAIN}}.crt
SSLCertificateKeyFile /etc/ssl/private/{{DOMAIN}}.key
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
</VirtualHost>

12
src/hubzilla.conf Normal file
View File

@@ -0,0 +1,12 @@
<VirtualHost *:80>
ServerName yourdomain.com
DocumentRoot /var/www/html
<Directory /var/www/html>
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

View File

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