diff --git a/Dockerfile b/Dockerfile index c06a2fa..68cd306 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,31 +1,27 @@ -FROM php:8.4-fpm +FROM php:8.4-fpm-alpine -# Set working directory early to avoid conflicts with host files WORKDIR /var/www # Install system dependencies -RUN apt-get update && apt-get install -y \ +RUN apk add --no-cache \ git \ curl \ libpng-dev \ - libonig-dev \ + oniguruma-dev \ libxml2-dev \ zip \ unzip \ libzip-dev \ - libicu-dev + icu-dev -# Install PHP extensions installer -ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ - -RUN chmod +x /usr/local/bin/install-php-extensions && \ - install-php-extensions pdo_mysql mbstring exif pcntl bcmath gd zip intl +# Install PHP extensions +RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd zip intl # Clear cache -RUN apt-get clean && rm -rf /var/lib/apt/lists/* +RUN rm -rf /var/cache/apk/* # Get latest Composer -COPY --from=docker.io/library/composer:latest /usr/bin/composer /usr/bin/composer +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer # Copy application files and fix permissions COPY . /var/www @@ -34,10 +30,8 @@ RUN chown -R www-data:www-data /var/www && \ find /var/www -type f -exec chmod 644 {} + && \ rm -rf /var/www/.circleci /var/www/.github -# Change current user to www USER www-data -# Expose port 8000 EXPOSE 8000 CMD ["php", "artisan", "serve", "--host=0.0.0.0", "--port=8000"] \ No newline at end of file