Fix: Entrypoint muss als root laufen für S6-overlay
- USER root am Ende des Dockerfile für /init
- set -e für bessere Fehlerbehandlung
- chmod 600 für .env Sicherheit
🤖 Generated with Claude Code
This commit is contained in:
@@ -27,7 +27,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
COPY docker-entrypoint.sh /usr/local/bin/
|
COPY docker-entrypoint.sh /usr/local/bin/
|
||||||
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||||
|
|
||||||
# Copy application
|
# Copy application (as www-data for composer)
|
||||||
USER www-data
|
USER www-data
|
||||||
WORKDIR /var/www/html
|
WORKDIR /var/www/html
|
||||||
COPY --chown=www-data:www-data . .
|
COPY --chown=www-data:www-data . .
|
||||||
@@ -35,6 +35,9 @@ COPY --chown=www-data:www-data . .
|
|||||||
# Install Composer dependencies (production)
|
# Install Composer dependencies (production)
|
||||||
RUN composer install --no-dev --optimize-autoloader --no-interaction
|
RUN composer install --no-dev --optimize-autoloader --no-interaction
|
||||||
|
|
||||||
|
# Switch back to root for S6-overlay /init
|
||||||
|
USER root
|
||||||
|
|
||||||
# Kein eigener Health Check - Coolify/Traefik übernimmt das
|
# Kein eigener Health Check - Coolify/Traefik übernimmt das
|
||||||
HEALTHCHECK NONE
|
HEALTHCHECK NONE
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Erstellt .env aus Docker Environment Variables
|
# Erstellt .env aus Docker Environment Variables
|
||||||
|
# Muss als root laufen (serversideup S6-overlay Requirement)
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
ENV_FILE="/var/www/html/.env"
|
ENV_FILE="/var/www/html/.env"
|
||||||
|
|
||||||
# Nur erstellen wenn nicht existiert
|
# .env aus Environment Variables erstellen
|
||||||
if [ ! -f "$ENV_FILE" ]; then
|
if [ ! -f "$ENV_FILE" ]; then
|
||||||
cat > "$ENV_FILE" << EOF
|
cat > "$ENV_FILE" << EOF
|
||||||
WP_ENV=${WP_ENV:-production}
|
WP_ENV=${WP_ENV:-production}
|
||||||
@@ -24,8 +27,9 @@ LOGGED_IN_SALT=${LOGGED_IN_SALT}
|
|||||||
NONCE_SALT=${NONCE_SALT}
|
NONCE_SALT=${NONCE_SALT}
|
||||||
EOF
|
EOF
|
||||||
chown www-data:www-data "$ENV_FILE"
|
chown www-data:www-data "$ENV_FILE"
|
||||||
echo ".env created from environment variables"
|
chmod 600 "$ENV_FILE"
|
||||||
|
echo "[entrypoint] .env created from environment variables"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Original entrypoint ausführen
|
# S6-overlay /init ausführen (als root!)
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user