Simplified version without custom scripts
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
# Piwigo Docker Image
|
# Piwigo Docker Image
|
||||||
# Based on official Piwigo image with optimizations for restore
|
# Based on official Piwigo image - minimal customization
|
||||||
|
|
||||||
FROM piwigo/piwigo:latest
|
FROM piwigo/piwigo:latest
|
||||||
|
|
||||||
@@ -16,51 +16,8 @@ RUN mkdir -p /usr/local/etc/php/conf.d && \
|
|||||||
echo 'post_max_size = 100M' >> /usr/local/etc/php/conf.d/piwigo-custom.ini && \
|
echo 'post_max_size = 100M' >> /usr/local/etc/php/conf.d/piwigo-custom.ini && \
|
||||||
echo 'max_file_uploads = 50' >> /usr/local/etc/php/conf.d/piwigo-custom.ini
|
echo 'max_file_uploads = 50' >> /usr/local/etc/php/conf.d/piwigo-custom.ini
|
||||||
|
|
||||||
# Create custom startup script in s6 init directory (runs during container init)
|
# Set default timezone to avoid TZ error in s6-overlay
|
||||||
RUN mkdir -p /etc/cont-init.d && \
|
ENV TZ=UTC
|
||||||
printf '%s\n' '#!/bin/bash' \
|
|
||||||
'# Custom startup script for Piwigo Docker container' \
|
# Use base image's entrypoint (docker-php-entrypoint)
|
||||||
'# Runs during s6-overlay init phase' \
|
# The base image already handles permissions and Apache startup
|
||||||
'' \
|
|
||||||
'set -e' \
|
|
||||||
'' \
|
|
||||||
'# Fix permissions on mounted volumes' \
|
|
||||||
'if [ -d "/var/www/html/upload" ]; then' \
|
|
||||||
' chown -R www-data:www-data /var/www/html/upload 2>/dev/null || true' \
|
|
||||||
' find /var/www/html/upload -type d -exec chmod 755 {} \; 2>/dev/null || true' \
|
|
||||||
' find /var/www/html/upload -type f -exec chmod 644 {} \; 2>/dev/null || true' \
|
|
||||||
'fi' \
|
|
||||||
'' \
|
|
||||||
'if [ -d "/var/www/html/local/config" ]; then' \
|
|
||||||
' chown -R www-data:www-data /var/www/html/local/config 2>/dev/null || true' \
|
|
||||||
' find /var/www/html/local/config -type f -exec chmod 644 {} \; 2>/dev/null || true' \
|
|
||||||
'fi' \
|
|
||||||
'' \
|
|
||||||
'if [ -d "/var/www/html/galleries" ]; then' \
|
|
||||||
' chown -R www-data:www-data /var/www/html/galleries 2>/dev/null || true' \
|
|
||||||
' find /var/www/html/galleries -type d -exec chmod 755 {} \; 2>/dev/null || true' \
|
|
||||||
' find /var/www/html/galleries -type f -exec chmod 644 {} \; 2>/dev/null || true' \
|
|
||||||
'fi' \
|
|
||||||
'' \
|
|
||||||
'# If config exists but no database, wait for DB' \
|
|
||||||
'if [ -f "/var/www/html/local/config/config.inc.php" ]; then' \
|
|
||||||
' echo "Config found, checking database connection..."' \
|
|
||||||
' ' \
|
|
||||||
' # Extract DB config from config.inc.php' \
|
|
||||||
' DB_HOST=$(grep -oP '"'"'"'"'"'"'db_host'"'"'"'"'"'"'\s*=>\s*'"'"'"'"'"'"'\K[^'"'"'"'"'"'"']+'"'"'"'"'"'"' /var/www/html/local/config/config.inc.php 2>/dev/null || echo "db")' \
|
|
||||||
' DB_USER=$(grep -oP '"'"'"'"'"'"'db_user'"'"'"'"'"'"'\s*=>\s*'"'"'"'"'"'"'\K[^'"'"'"'"'"'"']+'"'"'"'"'"'"' /var/www/html/local/config/config.inc.php 2>/dev/null || echo "piwigo")' \
|
|
||||||
' DB_PASS=$(grep -oP '"'"'"'"'"'"'db_password'"'"'"'"'"'"'\s*=>\s*'"'"'"'"'"'"'\K[^'"'"'"'"'"'"']+'"'"'"'"'"'"' /var/www/html/local/config/config.inc.php 2>/dev/null || echo "")' \
|
|
||||||
' DB_NAME=$(grep -oP '"'"'"'"'"'"'db_name'"'"'"'"'"'"'\s*=>\s*'"'"'"'"'"'"'\K[^'"'"'"'"'"'"']+'"'"'"'"'"'"' /var/www/html/local/config/config.inc.php 2>/dev/null || echo "piwigo")' \
|
|
||||||
' ' \
|
|
||||||
' # Wait for database' \
|
|
||||||
' for i in {1..30}; do' \
|
|
||||||
' if mariadb -h "$DB_HOST" -u "$DB_USER" -p"$DB_PASS" -e "SELECT 1" "$DB_NAME" >/dev/null 2>&1; then' \
|
|
||||||
' echo "Database connection successful"' \
|
|
||||||
' break' \
|
|
||||||
' fi' \
|
|
||||||
' echo "Waiting for database... ($i/30)"' \
|
|
||||||
' sleep 2' \
|
|
||||||
' done' \
|
|
||||||
'fi' \
|
|
||||||
> /etc/cont-init.d/99-custom-startup && \
|
|
||||||
chmod +x /etc/cont-init.d/99-custom-startup
|
|
||||||
Reference in New Issue
Block a user