# Production image for the JD Laravel API.
#
# serversideup/php is one container carrying nginx + php-fpm with sane
# production defaults, a non-root runtime user and a built-in autorun hook -
# AUTORUN_ENABLED (set by docker-compose) runs `artisan migrate --force` on
# boot, so a deploy is just `docker compose up -d --build`.
FROM serversideup/php:8.3-fpm-nginx

WORKDIR /var/www/html

COPY --chown=www-data:www-data composer.json composer.lock ./
RUN composer install --no-dev --no-interaction --no-scripts --optimize-autoloader

COPY --chown=www-data:www-data . .
RUN composer dump-autoload --optimize --no-dev
