alpha #1
81
dockerfile
81
dockerfile
@@ -2,65 +2,52 @@ FROM debian:12
|
|||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
ARG DOMAIN
|
# Installation des dépendances nécessaires
|
||||||
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 \
|
RUN apt-get update && apt-get install -y \
|
||||||
apache2 \
|
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 \
|
mariadb-client \
|
||||||
software-properties-common git msmtp mariadb-client cron curl unzip nano
|
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/*
|
||||||
|
|
||||||
# Nettoyer
|
# Configuration du répertoire de travail
|
||||||
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
WORKDIR /var/www/html
|
||||||
|
|
||||||
# Copier et activer la config Apache (HTTP uniquement)
|
# Clonage du dépôt Hubzilla
|
||||||
COPY src/container_apache.conf /etc/apache2/sites-available/${DOMAIN}.conf
|
RUN rm -r /var/www/html/
|
||||||
RUN sed -i "s/{{DOMAIN}}/${DOMAIN}/g" /etc/apache2/sites-available/${DOMAIN}.conf && \
|
RUN git clone https://framagit.org/hubzilla/core.git . && \
|
||||||
a2dissite 000-default.conf && \
|
mkdir -p store/[data]/smarty3 && \
|
||||||
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
|
chown -R www-data:www-data /var/www/html
|
||||||
|
|
||||||
|
# Activation des modules Apache nécessaires
|
||||||
|
RUN a2enmod rewrite ssl
|
||||||
|
|
||||||
# Configurer msmtp
|
# Configuration de PHP
|
||||||
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 && \
|
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 "post_max_size = 20M" >> /etc/php/8.2/apache2/php.ini && \
|
||||||
echo "register_argc_argv = On" >> /etc/php/8.2/apache2/php.ini
|
echo "register_argc_argv = On" >> /etc/php/8.2/apache2/php.ini
|
||||||
|
|
||||||
# Fichier .htconfig.php (préconfiguré)
|
# Configuration du site Apache
|
||||||
COPY src/.htconfig.php /tmp/.htconfig.php
|
COPY src/hubzilla.conf /etc/apache2/sites-available/hubzilla.conf
|
||||||
RUN LOCATION_HASH=$(cat /dev/urandom | tr -dc 'a-f0-9' | fold -w 64 | head -n 1) && \
|
RUN a2dissite 000-default.conf && a2ensite hubzilla.conf
|
||||||
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
|
# Copie du script de démarrage
|
||||||
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
|
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"]
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<VirtualHost *:80>
|
<VirtualHost *:80>
|
||||||
ServerName {{DOMAIN}}
|
ServerName yourdomain.com
|
||||||
DocumentRoot /var/www/html
|
DocumentRoot /var/www/html
|
||||||
|
|
||||||
<Directory /var/www/html>
|
<Directory /var/www/html>
|
||||||
@@ -7,6 +7,6 @@
|
|||||||
Require all granted
|
Require all granted
|
||||||
</Directory>
|
</Directory>
|
||||||
|
|
||||||
ErrorLog ${APACHE_LOG_DIR}/hubzilla_error.log
|
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||||
CustomLog ${APACHE_LOG_DIR}/hubzilla_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