FROM ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update -y && \
    apt-get install -y software-properties-common apache2 git nano && \
    add-apt-repository ppa:ondrej/php && \
    apt-get update -y && \
    apt-get install -y php5.6 php5.6-cli php5.6-json php5.6-common php5.6-mysql php5.6-zip php5.6-gd php5.6-mbstring php5.6-curl php5.6-xml php5.6-bcmath && \
    curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer 


RUN a2enmod rewrite headers && \
    sed -ri -e 's/^([ \t]*)(<\/VirtualHost>)/\1\tHeader set Access-Control-Allow-Origin "*"\n\1\2/g' /etc/apache2/sites-available/*.conf && \
    apt-get clean && rm -rf /var/lib/apt/lists/*

COPY ssl-self-signed-certs/localhost.crt /etc/ssl/certs/
COPY ssl-self-signed-certs/localhost.key /etc/ssl/private/

# Customize the default SSL site configuration
RUN sed -i \
    -e 's,/etc/ssl/certs/ssl-cert-snakeoil.pem,/etc/ssl/certs/localhost.crt,g' \
    -e 's,/etc/ssl/private/ssl-cert-snakeoil.key,/etc/ssl/private/localhost.key,g' \
    /etc/apache2/sites-available/default-ssl.conf

# Enable SSL module and the default SSL site
RUN a2enmod ssl && a2ensite default-ssl.conf

# Expose port 443 for SSL
EXPOSE 443

# Clear out pre-existing vendors (if any)
WORKDIR /var/www/html
RUN rm -rf vendor/
#COPY . /var/www/html/

CMD ["apachectl", "-D", "FOREGROUND"]

Leave a Reply

Your email address will not be published. Required fields are marked *