Compare commits

2 Commits
main ... main

Author SHA1 Message Date
6f6cc8fc63 hubzilla-nginx-v0.2 2025-05-20 19:30:00 +02:00
a148a8a1ad hubzilla-nginx-v1 2025-05-20 19:22:39 +02:00
5 changed files with 72 additions and 61 deletions

View File

@@ -2,51 +2,54 @@ FROM debian:12
ENV DEBIAN_FRONTEND=noninteractive
# Installation des dépendances nécessaires
# Dépôt PHP 8.2
RUN apt-get update && \
apt-get install -y lsb-release gnupg2 ca-certificates curl && \
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list && \
curl -fsSL https://packages.sury.org/php/apt.gpg | gpg --dearmor -o /etc/apt/trusted.gpg.d/php.gpg
# Installation paquets
RUN apt-get update && apt-get install -y \
apache2 \
nginx \
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 \
php8.2-fpm \
php8.2-cli \
php8.2-mysql \
php8.2-curl \
php8.2-gd \
php8.2-xml \
php8.2-zip \
php8.2-mbstring \
php8.2-bcmath \
php8.2-gmp \
php8.2-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
# Répertoire de travail
WORKDIR /var/www
# 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
# Cloner dans dossier temporaire
RUN git clone https://framagit.org/hubzilla/core.git /hubzilla-src && \
mkdir -p /hubzilla-src/store/[data]/smarty3 && \
chown -R www-data:www-data /hubzilla-src && \
chmod -R 750 /hubzilla-src
# Activation des modules Apache nécessaires
RUN a2enmod rewrite ssl
# Config PHP-FPM
RUN PHPINI=/etc/php/8.2/fpm/php.ini && \
[ -f "$PHPINI" ] && echo "upload_max_filesize = 20M" >> "$PHPINI" && \
echo "post_max_size = 20M" >> "$PHPINI" && \
echo "register_argc_argv = On" >> "$PHPINI"
# 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
# Config Nginx
COPY src/hubzilla-nginx.conf /etc/nginx/sites-available/hubzilla
RUN ln -s /etc/nginx/sites-available/hubzilla /etc/nginx/sites-enabled/hubzilla && \
rm -f /etc/nginx/sites-enabled/default
# 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
# Script de démarrage
COPY src/start.sh /start.sh
RUN chmod +x /start.sh

View File

@@ -1,12 +0,0 @@
<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>

20
src/hubzilla-nginx.conf Normal file
View File

@@ -0,0 +1,20 @@
server {
listen 80;
server_name localhost;
root /hubzilla-src;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}

View File

@@ -1,12 +0,0 @@
<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,19 @@
#!/bin/bash
# Démarrage du service Apache
service apache2 start
# Copie automatique si le volume bindé est vide
if [ ! "$(ls -A /var/www/html)" ]; then
echo "📁 Volume vide, initialisation des fichiers Hubzilla..."
cp -a /hubzilla-src/. /var/www/html/
chown -R www-data:www-data /var/www/html/
else
echo "📁 Volume déjà initialisé."
fi
# Attente indéfinie pour maintenir le conteneur en cours d'exécution
tail -f /dev/null
# Démarrage des services PHP-FPM et Nginx
echo "🚀 Démarrage des services PHP-FPM et Nginx..."
service php8.2-fpm start
service nginx start
# Maintien du conteneur actif
echo "📡 En attente (container actif)..."
tail -f /dev/null