anchor.diff:  FROM openjdk:8 AS init
   
  -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 /home
  -
  -# 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 \
  -  && 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 \
  -     ./
  -
  -WORKDIR /home/expanded
  -
  -# Expand WARs
  -RUN for archive in ../*.war; do unzip -d "$( basename "${archive%%.war}")" "$archive" ; done
  -
  -FROM openjdk:8
  +# 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"
  
positive.code: 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}"
  
  # Knowage home directory
  ENV KNOWAGE_DIRECTORY /home/knowage
  
  # 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
  
  WORKDIR ${KNOWAGE_DIRECTORY}
  
  
negative.code:   && apt-get install -q --no-install-recommends -y wget coreutils unzip mariadb-client-10.3 \
    && rm -rf /var/lib/apt/lists/*
  
  COPY --from=init ${KNOWAGE_DIRECTORY}/mysql/ ${KNOWAGE_DIRECTORY}/mysql/
  
  ENV MYSQL_SCRIPT_DIRECTORY ${KNOWAGE_DIRECTORY}/mysql
  
  COPY --from=init ${TOMCAT_HOME} ${TOMCAT_HOME}
  
  # Override Apache Tomcat server configuration and add security policy
  COPY server.xml knowage-default.policy ${TOMCAT_CONF}/
  