diff --git a/Dockerfile b/Dockerfile index 4afe7b6..b794569 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,9 @@ -FROM docker.io/php:8.4-fpm-alpine +FROM docker.io/alpine:3.21 -WORKDIR /var/www - -# We use the community repository to get pre-compiled PHP 8.4 extensions -# This skips the source-code extraction that is causing your permission errors +# Install PHP 8.4 and common extensions from Alpine community repos RUN apk add --no-cache \ - php84-pecl-msgpack \ + php84 \ + php84-fpm \ php84-pdo_mysql \ php84-mbstring \ php84-exif \ @@ -14,22 +12,27 @@ RUN apk add --no-cache \ php84-gd \ php84-zip \ php84-intl \ - icu-data-full + php84-curl \ + php84-tokenizer \ + php84-xml \ + php84-xmlwriter \ + php84-session \ + curl -# Symlink the extensions so PHP can find them (Alpine puts them in a different path) -RUN ln -s /usr/lib/php84/modules/*.so /usr/local/lib/php/extensions/no-debug-non-zts-20240924/ +# Create a symlink so 'php' command works +RUN ln -sf /usr/bin/php84 /usr/bin/php -# Get latest Composer +WORKDIR /var/www + +# Get Composer COPY --from=docker.io/composer:latest /usr/bin/composer /usr/bin/composer -# Copy application files +# Copy only the application files +# The .dockerignore will prevent it from touching restricted system folders COPY . /var/www -# Permission fix: Use a single RUN to reduce layer complexity -RUN chown -R www-data:www-data /var/www && \ - chmod -R 775 /var/www/storage /var/www/bootstrap/cache - -USER www-data +# Laravel permission fix +RUN chmod -R 775 /var/www/storage /var/www/bootstrap/cache EXPOSE 8000