# ---------- Dockerfile ----------
# Base image - PHP + Apache
FROM php:apache

# Install Python
RUN apt-get update && apt-get install -y \
        python3 \
        python3-pip \
        python3-dev \
        python3-setuptools \
        python3-venv \
        python3-flask \
        python3-yaml
        
# Install Other Stuff      
RUN apt-get install -y \  
        nginx \
        supervisor \
        net-tools \
        iputils-ping \
        nano \
    && rm -rf /var/lib/apt/lists/*

# remove default nginx config
RUN rm -rf /etc/nginx/sites-enabled/default 

# Copy application files
# Website Files
COPY www/ /var/www/html
# Python files
COPY api/ /usr/src/app/
# Config Files
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY apache_ports.conf /etc/apache2/ports.conf
COPY apache_vhost.conf /etc/apache2/sites-available/000-default.conf
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf

# Expose the ports you care about
EXPOSE 80 8080 5000

WORKDIR /usr/src/app

#   Start Supervisor
CMD ["/usr/bin/supervisord", "-n"]