beta #2
88
dockerfile
88
dockerfile
@@ -2,60 +2,52 @@ FROM debian:12
|
|||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
ARG DOMAIN
|
# Installation des dépendances nécessaires
|
||||||
ARG SMTP_EMAIL
|
RUN apt-get update && apt-get install -y \
|
||||||
ARG SMTP_SERVER
|
apache2 \
|
||||||
ARG SMTP_PORT
|
mariadb-client \
|
||||||
ARG SMTP_USER
|
php \
|
||||||
ARG SMTP_PASS
|
php-cli \
|
||||||
ARG ADMIN_EMAIL
|
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
|
# Configuration du répertoire de travail
|
||||||
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 \
|
WORKDIR /var/www/html
|
||||||
software-properties-common git openssl msmtp mariadb-client cron curl unzip nano
|
|
||||||
|
|
||||||
# Nettoyer
|
# Clonage du dépôt Hubzilla
|
||||||
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
|
|
||||||
RUN rm -r /var/www/html/
|
RUN rm -r /var/www/html/
|
||||||
RUN git clone https://framagit.org/hubzilla/core.git /var/www/html/
|
RUN git clone https://framagit.org/hubzilla/core.git . && \
|
||||||
RUN cd /var/www/html/ && util/add_addon_repo https://framagit.org/hubzilla/addons.git official
|
mkdir -p store/[data]/smarty3 && \
|
||||||
RUN mkdir -p "/var/www/html/store/[data]/smarty3" && \
|
chown -R www-data:www-data /var/www/html
|
||||||
chown -R www-data:www-data /var/www/html/
|
|
||||||
|
|
||||||
# Configurer msmtp
|
# Activation des modules Apache nécessaires
|
||||||
COPY src/msmtprc /etc/msmtprc
|
RUN a2enmod rewrite ssl
|
||||||
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
|
|
||||||
|
|
||||||
# Fichier .htconfig.php
|
# Configuration de PHP
|
||||||
COPY src/.htconfig.php /var/www/html/.htconfig.php
|
RUN echo "upload_max_filesize = 20M" >> /etc/php/8.2/apache2/php.ini && \
|
||||||
RUN LOCATION_HASH=$(cat /dev/urandom | tr -dc 'a-f0-9' | fold -w 64 | head -n 1) && \
|
echo "post_max_size = 20M" >> /etc/php/8.2/apache2/php.ini && \
|
||||||
sed -i "s/{{DOMAIN}}/${DOMAIN}/g" /var/www/html/.htconfig.php && \
|
echo "register_argc_argv = On" >> /etc/php/8.2/apache2/php.ini
|
||||||
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
|
|
||||||
|
|
||||||
# Cron
|
# Configuration du site Apache
|
||||||
RUN echo "*/15 * * * * cd /var/www/html; /usr/bin/php Zotlabs/Daemon/Master.php Cron" | crontab -u www-data -
|
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
|
COPY src/start.sh /start.sh
|
||||||
RUN chmod +x /start.sh
|
RUN chmod +x /start.sh
|
||||||
CMD ["/bin/bash", "/start.sh"]
|
|
||||||
|
CMD ["/bin/bash", "/start.sh"]
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ define('Z_PATH', dirname(__FILE__));
|
|||||||
define('Z_CONFIG', dirname(__FILE__));
|
define('Z_CONFIG', dirname(__FILE__));
|
||||||
define('Z_DATA', 'store');
|
define('Z_DATA', 'store');
|
||||||
|
|
||||||
$db_host = 'db'; // à ajuster si besoin
|
// Base de données
|
||||||
|
$db_host = 'db';
|
||||||
$db_port = 3306;
|
$db_port = 3306;
|
||||||
$db_user = 'hubzilla';
|
$db_user = 'hubzilla';
|
||||||
$db_pass = 'hubzilla_pass';
|
$db_pass = 'hubzilla_pass';
|
||||||
@@ -15,7 +16,6 @@ $db_data = 'hubzilla';
|
|||||||
$default_timezone = 'Europe/Paris';
|
$default_timezone = 'Europe/Paris';
|
||||||
|
|
||||||
$hostname = '{{DOMAIN}}';
|
$hostname = '{{DOMAIN}}';
|
||||||
$directory = '';
|
|
||||||
$site_location = 'https://{{DOMAIN}}/';
|
$site_location = 'https://{{DOMAIN}}/';
|
||||||
$admin_email = '{{ADMIN_EMAIL}}';
|
$admin_email = '{{ADMIN_EMAIL}}';
|
||||||
$site_id = '{{LOCATION_HASH}}';
|
$site_id = '{{LOCATION_HASH}}';
|
||||||
|
|||||||
@@ -1,21 +1,12 @@
|
|||||||
<VirtualHost *:80>
|
<VirtualHost *:80>
|
||||||
ServerName {{DOMAIN}}
|
ServerName yourdomain.com
|
||||||
Redirect permanent / https://{{DOMAIN}}/
|
|
||||||
</VirtualHost>
|
|
||||||
|
|
||||||
<VirtualHost *:443>
|
|
||||||
ServerName {{DOMAIN}}
|
|
||||||
|
|
||||||
DocumentRoot /var/www/html
|
DocumentRoot /var/www/html
|
||||||
|
|
||||||
<Directory /var/www/html>
|
<Directory /var/www/html>
|
||||||
AllowOverride All
|
AllowOverride All
|
||||||
Require all granted
|
Require all granted
|
||||||
</Directory>
|
</Directory>
|
||||||
|
|
||||||
SSLEngine on
|
|
||||||
SSLCertificateFile /etc/ssl/certs/{{DOMAIN}}.crt
|
|
||||||
SSLCertificateKeyFile /etc/ssl/private/{{DOMAIN}}.key
|
|
||||||
|
|
||||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
12
src/hubzilla.conf
Normal file
12
src/hubzilla.conf
Normal 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>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo "[INFO] Lancement du service cron..."
|
# Démarrage du service Apache
|
||||||
service cron start
|
service apache2 start
|
||||||
|
|
||||||
echo "[INFO] Lancement du serveur Apache..."
|
# Attente indéfinie pour maintenir le conteneur en cours d'exécution
|
||||||
apachectl -D FOREGROUND
|
tail -f /dev/null
|
||||||
Reference in New Issue
Block a user