anchor.diff:  ARG LIB_HSQLDB_JDBC_DRIVER_NAME="hsqldb-1.8.0.10.jar"
   ARG LIB_HSQLDB_JDBC_DRIVER_URL="https://search.maven.org/remotecontent?filepath=org/hsqldb/hsqldb/1.8.0.10/${LIB_HSQLDB_JDBC_DRIVER_NAME}"
   
  +ARG KNOWAGE_CORE_ENGINE="knowage"
  +ARG KNOWAGE_BIRTREPORT_ENGINE="${KNOWAGE_CORE_ENGINE}birtreportengine"
  +ARG KNOWAGE_COCKPIT_ENGINE="${KNOWAGE_CORE_ENGINE}cockpitengine"
  +ARG KNOWAGE_COMMONJ_ENGINE="${KNOWAGE_CORE_ENGINE}commonjengine"
  +ARG KNOWAGE_DATAMINING_ENGINE="${KNOWAGE_CORE_ENGINE}dataminingengine"
  +ARG KNOWAGE_GEOREPORT_ENGINE="${KNOWAGE_CORE_ENGINE}georeportengine"
  +ARG KNOWAGE_JASPERREPORT_ENGINE="${KNOWAGE_CORE_ENGINE}jasperreportengine"
  +ARG KNOWAGE_KPI_ENGINE="${KNOWAGE_CORE_ENGINE}kpiengine"
  +ARG KNOWAGE_META_ENGINE="${KNOWAGE_CORE_ENGINE}meta"
  +ARG KNOWAGE_QBE_ENGINE="${KNOWAGE_CORE_ENGINE}qbeengine"
  +ARG KNOWAGE_SVGVIEWER_ENGINE="${KNOWAGE_CORE_ENGINE}svgviewerengine"
  +ARG KNOWAGE_TALEND_ENGINE="${KNOWAGE_CORE_ENGINE}talendengine"
  +ARG KNOWAGE_WHATIF_ENGINE="${KNOWAGE_CORE_ENGINE}whatifengine"
  +ARG KNOWAGE_DATABASE_SCRIPT="${KNOWAGE_CORE_ENGINE}-database-scripts-mysql"
  +
  +WORKDIR ${KNOWAGE_DIRECTORY}
  +
  +# Download Apache Tomcat and extract it
  +RUN  wget -q "${APACHE_TOMCAT_URL}" \
  +  && unzip ${APACHE_TOMCAT_PACKAGE}.zip -x "*/webapps/manager/*" \
  +	"*/webapps/host-manager/*" \
  +	"*/webapps/examples/*" \
  +	"*/webapps/docs/*" \
  +	"*/webapps/ROOT/*"  \
  +  && rm ${APACHE_TOMCAT_PACKAGE}.zip \
  +  && ln -s ${APACHE_TOMCAT_PACKAGE} apache-tomcat
  +
  +# Install dependencies
  +RUN  apt-get update \
  +  && apt-get install -q --no-install-recommends -y unzip \
  +  && rm -rf /var/lib/apt/lists/*
  +
  +# Add MySql scripts
  +COPY ${KNOWAGE_DATABASE_SCRIPT}.zip ./
  +
  +# Extract database script
  +RUN  unzip ${KNOWAGE_DATABASE_SCRIPT}.zip "*create*" \
  +  && rm ${KNOWAGE_DATABASE_SCRIPT}.zip
  +
  +# Add Knowage engines
  +COPY ${KNOWAGE_CORE_ENGINE}.war \
  +     ${KNOWAGE_BIRTREPORT_ENGINE}.war \
  +     ${KNOWAGE_COCKPIT_ENGINE}.war \
  +     ${KNOWAGE_COMMONJ_ENGINE}.war \
  +     ${KNOWAGE_DATAMINING_ENGINE}.war \
  +     ${KNOWAGE_GEOREPORT_ENGINE}.war \
  +     ${KNOWAGE_JASPERREPORT_ENGINE}.war \
  +     ${KNOWAGE_KPI_ENGINE}.war \
  +     ${KNOWAGE_META_ENGINE}.war \
  +     ${KNOWAGE_QBE_ENGINE}.war \
  +     ${KNOWAGE_SVGVIEWER_ENGINE}.war \
  +     ${KNOWAGE_TALEND_ENGINE}.war \
  +     ${KNOWAGE_WHATIF_ENGINE}.war \
  +     ${TOMCAT_WEBAPPS}/
  +
  +# Expand WARs
  +RUN cd ${TOMCAT_WEBAPPS} && \
  +  for archive in *.war ; do unzip -d "$( basename "${archive%%.war}")" "$archive" ; rm ${archive} ; done	
  +
  +# Download Knowage libs and put them into Apache Tomcat lib
  +RUN  wget -q -O "${TOMCAT_LIB}/${LIB_COMMONS_LOGGING_NAME}"      "${LIB_COMMONS_LOGGING_URL}"      \
  +  && wget -q -O "${TOMCAT_LIB}/${LIB_COMMONS_LOGGING_API_NAME}"  "${LIB_COMMONS_LOGGING_API_URL}"  \
  +  && wget -q -O "${TOMCAT_LIB}/${LIB_CONCURRENT_NAME}"           "${LIB_CONCURRENT_URL}"           \
  +  && wget -q -O "${TOMCAT_LIB}/${LIB_MYSQL_CONNECTOR_NAME}"      "${LIB_MYSQL_CONNECTOR_URL}"      \
  +  && wget -q -O "${TOMCAT_LIB}/${LIB_GERONIMO_COMMONJ_NAME}"     "${LIB_GERONIMO_COMMONJ_URL}"     \
  +  && wget -q -O "${TOMCAT_LIB}/${LIB_MYFOO_COMMONJ_NAME}"        "${LIB_MYFOO_COMMONJ_URL}"        \
  +  && wget -q -O "${TOMCAT_LIB}/${LIB_POSTGRESQL_CONNECTOR_NAME}" "${LIB_POSTGRESQL_CONNECTOR_URL}" \
  +  && wget -q -O "${TOMCAT_LIB}/${LIB_HSQLDB_JDBC_DRIVER_NAME}"   "${LIB_HSQLDB_JDBC_DRIVER_URL}"
  +
  +FROM openjdk:8
  +
   # Knowage home directory
   ENV KNOWAGE_DIRECTORY /home/knowage
   
   # Tomcat sub-directories
  -ARG TOMCAT_HOME=${KNOWAGE_DIRECTORY}/${APACHE_TOMCAT_PACKAGE}
  +ARG TOMCAT_HOME=${KNOWAGE_DIRECTORY}/apache-tomcat
   ARG TOMCAT_BIN=${TOMCAT_HOME}/bin
   ARG TOMCAT_CONF=${TOMCAT_HOME}/conf
   ARG TOMCAT_LIB=${TOMCAT_HOME}/lib
   ARG TOMCAT_WEBAPPS=${TOMCAT_HOME}/webapps
  +ARG TOMCAT_RESOURCES=${TOMCAT_HOME}/resources
   
   WORKDIR ${KNOWAGE_DIRECTORY}
   
  
positive.code:   && apt-get install -q --no-install-recommends -y wget coreutils unzip mariadb-client-10.3 \
    && rm -rf /var/lib/apt/lists/*
  
  # Download Apache Tomcat and extract it
  RUN  wget -q "${APACHE_TOMCAT_URL}" \
    && unzip ${APACHE_TOMCAT_PACKAGE}.zip \
    && rm ${APACHE_TOMCAT_PACKAGE}.zip \
    && ln -s ${APACHE_TOMCAT_PACKAGE} apache-tomcat
  
  COPY --from=init /home/mysql/*create* ${KNOWAGE_DIRECTORY}/mysql/
  
  ENV MYSQL_SCRIPT_DIRECTORY ${KNOWAGE_DIRECTORY}/mysql
  
  COPY --from=init /home/expanded ${TOMCAT_WEBAPPS}/
  
  # Download Knowage libs and put them into Apache Tomcat lib
  RUN  wget -q -O "${TOMCAT_LIB}/${LIB_COMMONS_LOGGING_NAME}"      "${LIB_COMMONS_LOGGING_URL}"      \
    && wget -q -O "${TOMCAT_LIB}/${LIB_COMMONS_LOGGING_API_NAME}"  "${LIB_COMMONS_LOGGING_API_URL}"  \
    && wget -q -O "${TOMCAT_LIB}/${LIB_CONCURRENT_NAME}"           "${LIB_CONCURRENT_URL}"           \
    && wget -q -O "${TOMCAT_LIB}/${LIB_MYSQL_CONNECTOR_NAME}"      "${LIB_MYSQL_CONNECTOR_URL}"      \
    && wget -q -O "${TOMCAT_LIB}/${LIB_GERONIMO_COMMONJ_NAME}"     "${LIB_GERONIMO_COMMONJ_URL}"     \
    && wget -q -O "${TOMCAT_LIB}/${LIB_MYFOO_COMMONJ_NAME}"        "${LIB_MYFOO_COMMONJ_URL}"        \
    && wget -q -O "${TOMCAT_LIB}/${LIB_POSTGRESQL_CONNECTOR_NAME}" "${LIB_POSTGRESQL_CONNECTOR_URL}" \
    && wget -q -O "${TOMCAT_LIB}/${LIB_HSQLDB_JDBC_DRIVER_NAME}"   "${LIB_HSQLDB_JDBC_DRIVER_URL}"
  
  # Override Apache Tomcat server configuration and add security policy
  COPY server.xml knowage-default.policy ${TOMCAT_CONF}/
  
negative.code: FROM openjdk:8 AS init
  
  # Knowage home directory
  ENV KNOWAGE_DIRECTORY /home/knowage
  
  # Apache Tomcat
  ARG APACHE_TOMCAT_VERSION="8.5.37"
  ENV APACHE_TOMCAT_PACKAGE apache-tomcat-${APACHE_TOMCAT_VERSION}
  ARG APACHE_TOMCAT_URL="https://archive.apache.org/dist/tomcat/tomcat-8/v8.5.37/bin/${APACHE_TOMCAT_PACKAGE}.zip"
  
  # Tomcat sub-directories
  ARG TOMCAT_HOME=${KNOWAGE_DIRECTORY}/${APACHE_TOMCAT_PACKAGE}
  ARG TOMCAT_BIN=${TOMCAT_HOME}/bin
  ARG TOMCAT_CONF=${TOMCAT_HOME}/conf
  ARG TOMCAT_LIB=${TOMCAT_HOME}/lib
  ARG TOMCAT_WEBAPPS=${TOMCAT_HOME}/webapps
  
  # Knowage dependencies
  ARG LIB_COMMONS_LOGGING_NAME="commons-logging-1.1.1.jar"
  