# Arena-SI/CVT Web-Server Dockerfile
#-------------------------------------------------------------------------------

ARG IMG_FROM_URL="rx3-docker/php-apache:latest"

FROM ${IMG_FROM_URL}

ARG IMG_NAME
ARG IMG_NAME_FULL
ARG IMG_VERSION
ARG IMG_MAINTAINER
ARG IMG_URL

LABEL org.rx3.${IMG_NAME}.name=${IMG_NAME_FULL}
LABEL org.rx3.${IMG_NAME}.version=${IMG_VERSION}
LABEL org.rx3.${IMG_NAME}.maintainer=${IMG_MAINTAINER}
LABEL maintainer=${IMG_MAINTAINER}

ARG MODULE_NAME
ARG MODULE_PATH
ARG MODULE_VERSION
ARG WEB_SERVER_CONF_NAME

ARG WEB_SERVER_CONF_FILE="/etc/httpd/conf/sites.d/default_vhost.d/${WEB_SERVER_CONF_NAME}"



#-------------------------------------------------------------------------------------------------------
ARG WEB_SERVERD='#!/bin/bash                                                                         \n\
                                                                                                     \n\
                                                                                                     \n\
sed -i -e "${ENV_NET_SED}"                                                  '${WEB_SERVER_CONF_FILE}
#-------------------------------------------------------------------------------------------------------



RUN    . /etc/profile.d/rx3.sh && isl_add ${IMG_URL}                                                   \
    && echo  -e     "${WEB_SERVERD}"        | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/init.d/web-serverd \
    && chmod a+x    /etc/init.d/web-serverd                                                            \
    && ln    -s     /etc/init.d/web-serverd /etc/rcD.d/S30web-serverd
    
COPY ${MODULE_PATH}/conf.d/${WEB_SERVER_CONF_NAME}.ref ${WEB_SERVER_CONF_FILE}
COPY ${MODULE_PATH}/html                               /var/www/html
