FROM php:8.2-fpm-alpine # Install system dependencies and PostgreSQL libraries RUN apk add --no-cache \ libpng-dev \ libjpeg-turbo-dev \ freetype-dev \ postgresql-dev \ libpq \ unzip \ git # Configure and install PHP extensions RUN docker-php-ext-configure gd --with-freetype --with-jpeg \ && docker-php-ext-install -j$(nproc) gd pdo pdo_pgsql pgsql ENV REPO_URL= ENV GEOSERVER_URL= ENV GEOSERVER_USERNAME= ENV GEOSERVER_PASSWORD= ENV GEONETWORK_URL= ENV GEONETWORK_API_KEY= ENV GEONETWORK_API_VERSION= ENV PG_USER= ENV PG_PASS= ENV PG_NAME= ENV PG_HOST= # Install Composer COPY --from=composer:latest /usr/bin/composer /usr/bin/composer # Ensure the www-data user and group match the host system # RUN addgroup -g 1000 www-data && adduser -u 1000 -G www-data -s /bin/sh -D www-data # RUN addgroup -g 1000 nobody && adduser -u 1000 -G nobody -s /bin/sh -D nobody # Set permissions for /var/www/html # RUN mkdir -p /var/www/html && chown -R www-data:www-data /var/www/html RUN chown -R nobody:nobody /var/www/html /run # Copy project files COPY --chown=nobody . /var/www/html/ # Switch to the www-data user # USER www-data USER nobody # Set the working directory WORKDIR /var/www/html EXPOSE 9000 # Run Composer install CMD sh -c "composer install --no-dev --optimize-autoloader && php-fpm" USER root