Skip to content

Gateway

Description

This image permits lauching punch gateway :

  • punchplatform libraries (punch-gateway-app, punch-puncher-app)
  • a minimalist punchplatform.properties, saved to a mock Punch Platform conf dir (/opt/punch/conf);
  • a container environment :
    • GATEWAY_CONF_FILE set to the gateway conf file
    • PUNCHPLATFORM_CONF_DIR set to a mock Punch Platform conf dir (/opt/punch/conf)
    • PUNCHPLATFORM_INSTALL_DIR, set to a JSON-encoded string, which contains all the job-related information, as well as the platform properties.
    • PUNCHPLATFORM_GATEWAY_INSTALL_DIR, set to a JSON-encoded string, which contains all the gateway binairies
    • PUNCHPLATFORM_LOG_DIR, set to a JSON-encoded string, to specify log file
    • PUNCHPLATFORM_LOG4J_CONF_DIR, set to a JSON-encoded string, which contains loggers
    • PUNCHPLATFORM_PEX_CACHE_DIR, set to a JSON-encoded string, which describes pex cache dir location

The Dockerfile to contruct this image is the following :

ARG PUNCHPLATFORM_VERSION

FROM punchplatform/base:${PUNCHPLATFORM_VERSION}

ARG PUNCHPLATFORM_VERSION
ARG GATEWAY_CONF_ARCHIVE=punch-gateway-${PUNCHPLATFORM_VERSION}
ARG GATEWAY_EXECUTABLE_JAR=punch-gateway-app-${PUNCHPLATFORM_VERSION}.jar
ARG PUNCHER_EXECUTABLE_JAR=punch-puncher-app-${PUNCHPLATFORM_VERSION}-jar-with-dependencies.jar

WORKDIR /opt/punchplatform

# Env needed for starting gateway
ENV PUNCHPLATFORM_INSTALL_DIR=/opt/punchplatform/gateway
ENV PUNCHPLATFORM_GATEWAY_INSTALL_DIR=${PUNCHPLATFORM_INSTALL_DIR}
ENV PUNCHPLATFORM_CONF_DIR=${PUNCHPLATFORM_INSTALL_DIR}/conf
ENV PUNCHPLATFORM_LOG_DIR=/var/log/punchplatform
ENV PUNCHPLATFORM_PEX_CACHE_DIR=${PUNCHPLATFORM_GATEWAY_INSTALL_DIR}/.pex_cache
ENV PUNCHPLATFORM_LOG4J_CONF_DIR=${PUNCHPLATFORM_GATEWAY_INSTALL_DIR}/log4j2
ENV PUNCHPLATFORM_PROPERTIES_FILE=${PUNCHPLATFORM_GATEWAY_INSTALL_DIR}/punchplatform.properties

ENV GATEWAY_CONF_FILE=${PUNCHPLATFORM_CONF_DIR}/config.yml

VOLUME ${PUNCHPLATFORM_CONF_DIR}

COPY target/dependencies/${GATEWAY_CONF_ARCHIVE}.zip .
COPY target/dependencies/${GATEWAY_EXECUTABLE_JAR} gateway/lib/gateway.jar
COPY target/dependencies/${PUNCHER_EXECUTABLE_JAR} gateway/lib/${PUNCHER_EXECUTABLE_JAR}
COPY resources/punchplatform.properties ${PUNCHPLATFORM_PROPERTIES_FILE}
COPY resources/start_gateway.sh /usr/bin/
COPY target/dependency/punch-resources-${PUNCHPLATFORM_VERSION}/conf/resources/punch ${PUNCHPLATFORM_CONF_DIR}/resources/punch

RUN chmod +x /usr/bin/start_gateway.sh && unzip ${GATEWAY_CONF_ARCHIVE}.zip && mv ${GATEWAY_CONF_ARCHIVE}/* gateway/ && rm -r ${GATEWAY_CONF_ARCHIVE}*

CMD "start_gateway.sh"

with start_gateway.sh

#!/bin/bash

if [[ -f "$GATEWAY_CONF_FILE" ]]; then
  java -jar gateway/lib/gateway.jar --spring.config.location=$GATEWAY_CONF_FILE
else
  java -jar gateway/lib/gateway.jar
fi

Usage

This image is used in punch helm gateway

Get it !

docker pull gitlab.thalesdigital.io:5005/punch/product/pp-punch/gateway