Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Introduction

  • Users can build their own Docker images for JOC Cockpit.
  • This article explains options how to create the JOC Cockpit image.

Dockerfile

Docker images for JS7 JOC Cockpit provided by SOS make use of the following Dockerfile:

Code Block
languagebash
titleDockerfile for JOC Cockpit Image
linenumberstrue
collapsetrue
FROM openjdk:8-jre

LABEL maintainer="Software- und Organisations-Service GmbH"

# BUILD SETTINGS

# provide build arguments for release information
ARG JS_MAJOR
ARG JS_RELEASE

# default user id has to match later run-time user
ARG JS_USER_ID=${JS_USER_ID:-1001}
ARG JS_HTTP_PORT=${JS_HTTP_PORT:-4446}
ARG JS_HTTPS_PORT=${JS_HTTPS_PORT:-4443}
ARG JS_JAVA_OPTIONS=${JS_JAVA_OPTIONS}

# RUN-TIME SETTINGS

# JS7 JobScheduler ports and Java options
ENV RUN_JS_HTTP_PORT=${RUN_JS_HTTP_PORT:-$JS_HTTP_PORT}
ENV RUN_JS_HTTPS_PORT=${RUN_JS_HTTPS_PORT:-$JS_HTTPS_PORT}
ENV RUN_JS_JAVA_OPTIONS=${RUN_JS_JAVA_OPTIONS:-$JS_JAVA_OPTIONS}

# PREPARATION

# install process tools, bash
RUN apt-get update && \
    apt-get install -y procps && \
    apt-get install -y bash

# add installer tarball
# ADD https://download.sos-berlin.com/JobScheduler.${JS_MAJOR}/js7_joc_linux.${JS_RELEASE}.tar.gz /usr/local/src/
COPY js7_joc_linux.${JS_RELEASE}.tar.gz /usr/local/src/

# INSTALLATION

# extract installer tarball
#   for JDK < 12, /dev/random does not provide sufficient entropy, see https://kb.sos-berlin.com/x/lIM3
RUN test -e /usr/local/src/js7_joc_linux.${JS_RELEASE}.tar.gz && \
    tar zxvf /usr/local/src/js7_joc_linux.${JS_RELEASE}.tar.gz -C /usr/local/src/ && \
    rm -f /usr/local/src/js7_joc_linux.${JS_RELEASE}.tar.gz && \
    ln -s /usr/local/src/joc.${JS_RELEASE} /usr/local/src/joc && \
    sed -i 's/securerandom.source=file:\/dev\/random/securerandom.source=file:\/dev\/urandom/g' /usr/local/openjdk-8/lib/security/java.security

# copy installer response file, hibernate configuration file and start script
COPY joc_install.xml /usr/local/src/joc/
COPY hibernate.cfg.xml /usr/local/src/joc/
COPY start-joc.sh /usr/local/bin/

# perform installation and make default user the owner of directorie
RUN groupadd --gid ${JS_USER_ID:-1001} jobscheduler && \
    useradd --uid ${JS_USER_ID:-1001} --gid jobscheduler --home-dir /home/jobscheduler --no-create-home --shell /bin/bash jobscheduler && \
    cd /usr/local/src/joc && ./setup.sh -u joc_install.xml && \
    chown -R jobscheduler:jobscheduler /var/sos-berlin.com && \
    chmod +x /usr/local/bin/start-joc.sh

# CONFIGURATION

# security: https and certificates
RUN  java -jar "/opt/sos-berlin.com/js7/joc/jetty/start.jar" -Djetty.home="/opt/sos-berlin.com/js7/joc/jetty" -Djetty.base="/var/sos-berlin.com/js7/joc" --add-to-start=https

COPY https-keystore.p12 /var/sos-berlin.com/js7/joc/resources/joc/
COPY https-truststore.p12 /var/sos-berlin.com/js7/joc/resources/joc/

COPY start.ini.add /tmp/
COPY joc.properties.add /tmp/
RUN  cat /tmp/start.ini.add >> /var/sos-berlin.com/js7/joc/start.ini && \
     cat /tmp/joc.properties.add >> /var/sos-berlin.com/js7/joc/resources/joc/joc.properties

# copy configuration
COPY config/ /var/sos-berlin.com/js7/joc/resources/

RUN  chown -R jobscheduler:jobscheduler /var/sos-berlin.com

# CODA

# allow incoming traffic to port
EXPOSE $RUN_JS_HTTP_PORT $RUN_JS_HTTPS_PORT

# run-time user, can be overwritten when running the container
USER jobscheduler

CMD ["sh","-c","/usr/local/bin/start-joc.sh --java-options=\"$RUN_JS_JAVA_OPTIONS\""]

Build Script

The build script offers a number of options to parameterize the Dockerfile:

...