# WordPress Bedrock - Production
FROM serversideup/php:8.4-fpm-nginx

LABEL org.opencontainers.image.title="Kurs-Booking WordPress"
LABEL org.opencontainers.image.vendor="webideas24"

# Environment
ENV WEB_DOCUMENT_ROOT=/var/www/html/web
ENV PHP_OPCACHE_ENABLE=1
ENV PHP_MEMORY_LIMIT=512M
ENV PHP_UPLOAD_MAX_FILE_SIZE=64M
ENV PHP_POST_MAX_SIZE=64M

# Install dependencies
USER root
RUN apt-get update && apt-get install -y --no-install-recommends \
    git \
    unzip \
    curl \
    && rm -rf /var/lib/apt/lists/*

# Copy application
USER www-data
WORKDIR /var/www/html
COPY --chown=www-data:www-data . .

# Install Composer dependencies (production)
RUN composer install --no-dev --optimize-autoloader --no-interaction

# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
    CMD curl -fsS http://localhost/wp/wp-login.php || exit 1

EXPOSE 80
