FROM php:7.4-apache

# Remover socket residual do Supervisor
RUN rm -f /var/run/supervisor.sock

RUN apt-get update && apt-get upgrade -y && apt install supervisor -y

# Permitir o uso de variáveis de ambiente no Apache
RUN a2enmod rewrite env

# Copiar arquivos de configuração
COPY 000-default.conf /etc/apache2/sites-enabled/000-default.conf
COPY www/ /var/www/
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf

# Definir variáveis de ambiente no Apache
ENV APACHE_RUN_USER=www-data
ENV APACHE_RUN_GROUP=www-data

# Comando de inicialização
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]


