FROM php:8.1-fpm-alpine WORKDIR /var/www/html # Install PHP extensions and dependencies RUN apk add --no-cache \ nginx \ # Add other extensions like pdo_mysql, gd, etc. && docker-php-ext-install pdo_mysql # Copy Composer files and install dependencies (for caching efficiency) COPY composer.json composer.lock ./ RUN composer install --no-dev --optimize-autoloader --no-scripts --prefer-dist # Copy application source code COPY . . # Set correct permissions RUN chown -R www-data:www-data /var/www/html EXPOSE 9000 CMD ["php-fpm"]