This commit is contained in:
H3XploR
2025-07-08 01:08:28 +02:00
parent 2117ce50f4
commit 40328d2980
30 changed files with 246 additions and 213 deletions
+15 -26
View File
@@ -1,33 +1,22 @@
FROM debian:11
FROM alpine:3.20
RUN apt-get update && apt-get install -y \
mariadb-client \
curl \
php7.4-fpm \
php7.4-mysql \
php7.4-cli \
php7.4-curl \
php7.4-gd \
php7.4-mbstring \
php7.4-xml \
php7.4-zip \
&& apt-get clean
# Fix: créer le dossier /run/php
RUN mkdir -p /run/php
# Fix: forcer php-fpm à écouter sur le port 9000
RUN sed -i 's|listen = /run/php/php7.4-fpm.sock|listen = 9000|' /etc/php/7.4/fpm/pool.d/www.conf
RUN apk update && \
apk add --no-cache php82 php82-fpm php82-mysqli php82-json php82-session php82-phar \
php82-xml php82-mbstring php82-gd php82-curl php82-dom wget bash && \
adduser -D -g 'www' www
WORKDIR /var/www/html
RUN curl -o wordpress.tar.gz https://wordpress.org/latest.tar.gz && \
tar -xzf wordpress.tar.gz --strip-components=1 && \
rm wordpress.tar.gz
# Téléchargement de WordPress
RUN wget https://wordpress.org/latest.tar.gz && \
tar -xzf latest.tar.gz --strip-components=1 && \
rm latest.tar.gz
COPY conf/wp-config.php /var/www/html/wp-config.php
COPY tools/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh && \
chown -R www:www /var/www/html && \
sed -i 's|listen = .*|listen = 0.0.0.0:9000|' /etc/php82/php-fpm.d/www.conf
USER www
EXPOSE 9000
CMD ["/usr/sbin/php-fpm7.4", "-F"]
ENTRYPOINT ["/entrypoint.sh"]
@@ -1,18 +0,0 @@
<?php
define( 'DB_NAME', getenv('MYSQL_DATABASE') );
define( 'DB_USER', trim(file_get_contents(getenv('MYSQL_USER_FILE'))) );
define( 'DB_PASSWORD', trim(file_get_contents(getenv('MYSQL_PASSWORD_FILE'))) );
define( 'DB_HOST', 'mariadb' );
define( 'DB_CHARSET', 'utf8mb4' );
define( 'DB_COLLATE', '' );
$table_prefix = 'wp_';
define( 'WP_DEBUG', false );
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', __DIR__ . '/' );
}
require_once ABSPATH . 'wp-settings.php';
+15
View File
@@ -0,0 +1,15 @@
#!/bin/sh
set -eu
CONFIG=/var/www/html/wp-config.php
if [ ! -f "$CONFIG" ]; then
cp wp-config-sample.php $CONFIG
sed -i "s/database_name_here/${WORDPRESS_DB_NAME}/" $CONFIG
sed -i "s/username_here/${WORDPRESS_DB_USER}/" $CONFIG
sed -i "s/password_here/$(cat ${WORDPRESS_DB_PASSWORD_FILE})/" $CONFIG
sed -i "s/localhost/${WORDPRESS_DB_HOST}/" $CONFIG
fi
# Lancement de php-fpm au premier plan
php-fpm --nodaemonize