diff --git a/Dockerfile b/Dockerfile index 68cd306..2e09deb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,29 +2,22 @@ FROM php:8.4-fpm-alpine WORKDIR /var/www -# Install system dependencies -RUN apk add --no-cache \ - git \ - curl \ - libpng-dev \ - oniguruma-dev \ - libxml2-dev \ - zip \ - unzip \ - libzip-dev \ - icu-dev +# Install the PHP extension installer helper +ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ -# Install PHP extensions -RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd zip intl - -# Clear cache -RUN rm -rf /var/cache/apk/* +# Install system dependencies and PHP extensions in one go +# This script handles the 'apk add' and 'apk del' for dev-libraries automatically +RUN chmod +x /usr/local/bin/install-php-extensions && \ + install-php-extensions pdo_mysql mbstring exif pcntl bcmath gd zip intl # Get latest Composer COPY --from=composer:latest /usr/bin/composer /usr/bin/composer -# Copy application files and fix permissions +# Copy application files COPY . /var/www + +# Fix permissions +# We do this as root before switching to the unprivileged user RUN chown -R www-data:www-data /var/www && \ find /var/www -type d -exec chmod 755 {} + && \ find /var/www -type f -exec chmod 644 {} + && \