# Crypto IPG — all-in-one image (nginx + PHP-FPM + cron watcher)
FROM php:8.2-fpm-alpine

RUN apk add --no-cache nginx supervisor curl \
 && docker-php-ext-install pdo_mysql bcmath \
 && rm -rf /var/cache/apk/*

WORKDIR /var/www/html
COPY . /var/www/html

# nginx + php + supervisor config
COPY docker/nginx.conf     /etc/nginx/nginx.conf
COPY docker/php.ini        /usr/local/etc/php/conf.d/zz-app.ini
COPY docker/supervisord.conf /etc/supervisord.conf
COPY docker/entrypoint.sh  /entrypoint.sh
RUN chmod +x /entrypoint.sh \
 && mkdir -p storage/logs \
 && chown -R www-data:www-data /var/www/html/storage \
 && chmod -R 775 /var/www/html/storage

EXPOSE 80
ENTRYPOINT ["/entrypoint.sh"]
CMD ["supervisord", "-c", "/etc/supervisord.conf"]
