Versions Compared

Key

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

...

Code Block
languagebash
titleDockerfile for Controller Image
linenumberstrue
collapsetrue
FROM openjdk:8-jre-alpine

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

# BUILD SETTINGS

# provide build arguments for release information
ARG JS_RELEASE
ARG JS_RELEASE_MAJOR

# default user id has to match later run-time user
ARG JS_USER_ID=${JS_USER_ID:-1001}
ARG JS_ID=${JS_ID:-jobscheduler}
ARG JS_HTTP_INTERFACE=${JS_HTTP_INTERFACE:-0.0.0.0}
ARG JS_HTTP_PORT=${JS_HTTP_PORT:-4444}
ARG JS_HTTPS_INTERFACE=${JS_HTTPS_INTERFACE:-0.0.0.0}
ARG JS_HTTPS_PORT=${JS_HTTPS_PORT:-4443}
ARG JS_JAVA_OPTIONS=${JS_JAVA_OPTIONS}

# RUN-TIME SETTINGS

# JS7 Controller ID, ports and Java options
ENV RUN_JS_ID=${RUN_JS_ID:-$JS_ID}
ENV RUN_JS_HTTP_INTERFACE=${RUN_JS_HTTP_INTERFACE:-$JS_HTTP_INTERFACE}
ENV RUN_JS_HTTP_PORT=${RUN_JS_HTTP_PORT:-$JS_HTTP_PORT}
ENV RUN_JS_HTTPS_INTERFACE=${RUN_JS_HTTPS_INTERFACE:-$JS_HTTPS_INTERFADEINTERFACE}
ENV RUN_JS_HTTPS_PORT=${RUN_JS_HTTPS_PORT}
ENV RUN_JS_JAVA_OPTIONS=${RUN_JS_JAVA_OPTIONS:-$JS_JAVA_OPTIONS}

# PREPARATION

# install process tools, net tools, bash
RUN apk update && apk add --no-cache \
    procps \
    net-tools \
    bash

# setup working directory
RUN mkdir -p /var/sos-berlin.com/js7
WORKDIR /var/sos-berlin.com/js7

# add/copy installation tarball
# ADD https://download.sos-berlin.com/JobScheduler.${JS_RELEASE_MAJOR}/js7_controller_unix.${JS_RELEASE}.tar.gz /usr/local/src/
COPY js7_controller_unix.${JS_RELEASE}.tar.gz /usr/local/src/

# add start script
COPY start-controller.sh  /usr/local/bin/

# INSTALLATION

# extract installation tarball
# for JDK < 12, /dev/random does not provide sufficient entropy, see https://kb.sos-berlin.com/x/lIM3
# add jobscheduler user account and make it the owner of directories
RUN adduser -u ${JS_USER_ID:-1001} --disabled-password --home /home/jobscheduler --no-create-home --shell /bin/bash jobscheduler jobscheduler && \
    test -e /usr/local/src/js7_controller_unix.${JS_RELEASE}.tar.gz && \
    tar xfvz /usr/local/src/js7_controller_unix.${JS_RELEASE}.tar.gz -C /var/sos-berlin.com/js7/ && \
    rm /usr/local/src/js7_controller_unix.${JS_RELEASE}.tar.gz && \
    chown -R jobscheduler:jobscheduler /var/sos-berlin.com && \
    chmod +x /usr/local/bin/start-controller.sh && \
    sed -i 's/securerandom.source=file:\/dev\/random/securerandom.source=file:\/dev\/urandom/g' /usr/lib/jvm/java-1.8-openjdk/jre/lib/security/java.security

# CONFIGURATION

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

# CODA

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

CMD ["sh","-c","/usr/local/bin/start-controller.sh --id=\"$RUN_JS_ID\" --http-port=$RUN_JS_HTTP_INTERFACE:$RUN_JS_HTTP_PORT --https-port=$RUN_JS_HTTPS_INTERFACE:$RUN_JS_HTTPS_PORT --java-options=\"$RUN_JS_JAVA_OPTIONS\""]

...