FROM httpd:2.4-alpine

ARG SERVER_NAMEZ
ENV SERVER_NAME=${SERVER_NAMEZ}
ENV TZ=Europe/Paris
ENV APP_ROOT=/var/www/
ENV DOCUMENT_ROOT=${APP_ROOT}/html/
ENV APACHE_LOG_DIR=/usr/local/apache2/logs/
ENV APACHE_RUN_USER=www-data
ENV APACHE_RUN_GROUP=www-data

RUN apk add --update --no-cache tzdata

WORKDIR ${APP_ROOT}

RUN mkdir -p ${APP_ROOT}
RUN mkdir -p ${DOCUMENT_ROOT}

RUN chown -R ${APACHE_RUN_USER}:${APACHE_RUN_GROUP} ${APP_ROOT}
RUN chown -R ${APACHE_RUN_USER}:${APACHE_RUN_GROUP} ${DOCUMENT_ROOT}

RUN ln -s ${APP_ROOT}/public_html/index.php ${DOCUMENT_ROOT}

COPY ./httpd.conf /usr/local/apache2/conf/httpd.conf
COPY ./httpd-ssl.conf /usr/local/apache2/conf/extra/httpd-ssl.conf