forked from sylvain/hubzilla
Actualiser dockerfile
This commit is contained in:
62
dockerfile
62
dockerfile
@@ -11,46 +11,52 @@ ARG SMTP_PASS
|
|||||||
ARG ADMIN_EMAIL
|
ARG ADMIN_EMAIL
|
||||||
|
|
||||||
# Installer les paquets nécessaires
|
# 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 \
|
RUN apt-get update && apt-get install -y \
|
||||||
software-properties-common git openssl msmtp mariadb-client cron curl unzip nano
|
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
|
# Nettoyer
|
||||||
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
# Générer un certificat SSL auto-signé
|
# Copier et activer la config Apache (HTTP uniquement)
|
||||||
RUN mkdir -p /etc/ssl/private && mkdir -p /etc/ssl/certs && \
|
COPY src/container_apache.conf /etc/apache2/sites-available/${DOMAIN}.conf
|
||||||
openssl req -x509 -nodes -subj "/C=FR/ST=France/L=Paris/O=organization/OU=Org/CN=${DOMAIN}" \
|
RUN sed -i "s/{{DOMAIN}}/${DOMAIN}/g" /etc/apache2/sites-available/${DOMAIN}.conf && \
|
||||||
-newkey rsa:4096 -keyout /etc/ssl/private/${DOMAIN}.key -out /etc/ssl/certs/${DOMAIN}.crt -days 365
|
a2dissite 000-default.conf && \
|
||||||
|
a2ensite ${DOMAIN}.conf && \
|
||||||
# Copier et activer la config Apache
|
a2enmod rewrite
|
||||||
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
|
# Installer Hubzilla
|
||||||
RUN rm -r /var/www/html/
|
WORKDIR /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
|
util/add_addon_repo https://framagit.org/hubzilla/addons.git official && \
|
||||||
RUN mkdir -p "/var/www/html/store/[data]/smarty3" && \
|
mkdir -p store/[data]/smarty3 && \
|
||||||
chown -R www-data:www-data /var/www/html/
|
chown -R www-data:www-data /var/www/html
|
||||||
|
|
||||||
# Configurer msmtp
|
# Configurer msmtp
|
||||||
COPY src/msmtprc /etc/msmtprc
|
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 && \
|
RUN sed -i "s/{{SMTP_EMAIL}}/${SMTP_EMAIL}/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_SERVER}}/${SMTP_SERVER}/g" /etc/msmtprc && \
|
||||||
sed -i "s/{{SMTP_PASS}}/${SMTP_PASS}/g" /etc/msmtprc
|
sed -i "s/{{SMTP_PORT}}/${SMTP_PORT}/g" /etc/msmtprc && \
|
||||||
|
sed -i "s/{{SMTP_USER}}/${SMTP_USER}/g" /etc/msmtprc && \
|
||||||
RUN chmod 600 /etc/msmtprc && chown www-data:www-data /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
|
RUN echo "sendmail_path = /usr/bin/msmtp -t" >> /etc/php/8.2/apache2/php.ini
|
||||||
|
|
||||||
# Fichier .htconfig.php
|
# 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 /var/www/html/.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) && \
|
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/{{DOMAIN}}/${DOMAIN}/g" /var/www/html/.htconfig.php && \
|
||||||
sed -i "s/{{LOCATION_HASH}}/${LOCATION_HASH}/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
|
sed -i "s/{{ADMIN_EMAIL}}/${ADMIN_EMAIL}/g" /var/www/html/.htconfig.php
|
||||||
|
|
||||||
# Cron
|
# Cron
|
||||||
RUN echo "*/15 * * * * cd /var/www/html; /usr/bin/php Zotlabs/Daemon/Master.php Cron" | crontab -u www-data -
|
RUN echo "*/15 * * * * cd /var/www/html; /usr/bin/php Zotlabs/Daemon/Master.php Cron" | crontab -u www-data -
|
||||||
@@ -58,4 +64,4 @@ RUN echo "*/15 * * * * cd /var/www/html; /usr/bin/php Zotlabs/Daemon/Master.php
|
|||||||
# Script de démarrage
|
# 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"]
|
||||||
|
|||||||
Reference in New Issue
Block a user