FROM php:8.2-fpm # EXPOSE 9000 # Install any PHP extensions or packages you need RUN apt-get update && apt-get install -y \ git \ curl \ libpng-dev \ libpq-dev \ libjpeg-dev \ libfreetype6-dev \ zip \ unzip \ && docker-php-ext-configure gd \ && docker-php-ext-install -j$(nproc) gd \ && docker-php-ext-install pdo pdo_pgsql pgsql mbstring exif bcmath pcntl # Ensure the www-data user and group match the host system # RUN groupadd -g 1000 www-data && useradd -u 1000 -g www-data -s /bin/bash # RUN useradd -u 1000 -g www-data -s /bin/bash # Copy composer from the official image COPY --from=composer /usr/bin/composer /usr/bin/composer WORKDIR /var/www/html # ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ # Install PHP extensions RUN chmod +x /usr/local/bin/install-php-extensions; \ # Set permissions for /var/www/html COPY --chown=www-data:www-data . /var/www/html # Copy project files USER www-data # Run Composer install CMD bash -c "composer install --no-dev --optimize-autoloader"