Dockerfile boot-layer-service-jdk11

I see that the Dockerfiles used in the starter project all extend from repository.broadleafcommerce.com:5001/broadleaf/boot-layer-service-jdk11, can you provide some details around that image?


Update from August 2022 - This image is no longer in use by Broadleaf. Please see the following article for more information: https://developer.broadleafcommerce.com/starter-projects/docker-configuration


Below you will find relevant resources:

boot-layer-service-jdk11 Dockerfile

# Used as a base image that other Spring Boot-based
# docker containers can be based off of. This can
# be built in 2 modes:
# 1. Normal - assumes an /app.jar is present that
#	represents a fat Spring-Bootified jar file
# 2. Jrebel - also downloads the Jrebel agent embedded in the image.
#	An image with the JRebel agent downloaded can set a JREBEL environment
#	variable (must be a non-empty string) to activate the Jrebel JVM parameters

FROM adoptopenjdk/openjdk11:jdk-11.0.7_10-alpine
VOLUME /tmp
ADD run-app.sh run-app.sh
RUN chmod +x run-app.sh

ADD wait-for.sh wait-for.sh
RUN chmod +x wait-for.sh

# Only downloads jrebel if the argument is set
ARG JREBEL
ENV JREBEL=${JREBEL}
ADD download-jrebel.sh download-jrebel.sh
RUN chmod +x download-jrebel.sh && ./download-jrebel.sh

ENTRYPOINT ./run-app.sh

Which references the following scripts:

run-app.sh

#!/bin/sh

if [ "$DEBUG_PORT" ]; then
  export JAVA_OPTS="$JAVA_OPTS -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:$DEBUG_PORT"
fi

if [ "$JREBEL" ]; then
  export JREBEL_ARGS="-agentpath:jrebel/lib/libjrebel64.so -Drebel.remoting_plugin=true"
  export JAVA_OPTS="$JAVA_OPTS $JREBEL_ARGS"
fi

if [ "$YOURKIT_PORT" ]; then
  wget --no-check-certificate https://www.yourkit.com/download/docker/YourKit-JavaProfiler-2019.8-docker.zip -P /tmp/ && \
  unzip /tmp/YourKit-JavaProfiler-2019.8-docker.zip -d /usr/local && \
  rm /tmp/YourKit-JavaProfiler-2019.8-docker.zip
  export YOURKIT_ARGS="-agentpath:/usr/local/YourKit-JavaProfiler-2019.8/bin/linux-x86-64/libyjpagent.so=port=$YOURKIT_PORT,listen=all"
  export JAVA_OPTS="$JAVA_OPTS $YOURKIT_ARGS"
fi

# Moved into a shell script because the above 'export' statements cannot be retrieved
# between multiple statements in a Dockerfile
echo "Starting Java with the arguments $JAVA_OPTS"
java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom org.springframework.boot.loader.JarLauncher

wait-for.sh

#!/bin/sh

# Copied from https://github.com/eficode/wait-for for alpine compatibility

TIMEOUT=15
QUIET=0

echoerr() {
  if [ "$QUIET" -ne 1 ]; then printf "%s\n" "$*" 1>&2; fi
}

usage() {
  exitcode="$1"
  cat << USAGE >&2
Usage:
  $cmdname host:port [-t timeout] [-- command args]
  -q | --quiet                        Do not output any status messages
  -t TIMEOUT | --timeout=timeout      Timeout in seconds, zero for no timeout
  -- COMMAND ARGS                     Execute command with args after the test finishes
USAGE
  exit "$exitcode"
}

wait_for() {
  echo "Waiting for $HOST:$PORT for ${TIMEOUT}s"
  for i in `seq $TIMEOUT` ; do
    nc -z "$HOST" "$PORT" > /dev/null 2>&1
    
    result=$?
    if [ $result -eq 0 ] ; then
      if [ $# -gt 0 ] ; then
        echo "$HOST:$PORT available after ${i}s, executing $@"
        exec "$@"
      fi
      exit 0
    fi
    echo "$HOST:$PORT not available, back to sleep..."
    sleep 1
  done
  echo "Operation timed out" >&2
  exit 1
}

while [ $# -gt 0 ]
do
  case "$1" in
    *:* )
    HOST=$(printf "%s\n" "$1"| cut -d : -f 1)
    PORT=$(printf "%s\n" "$1"| cut -d : -f 2)
    shift 1
    ;;
    -q | --quiet)
    QUIET=1
    shift 1
    ;;
    -t)
    TIMEOUT="$2"
    if [ "$TIMEOUT" = "" ]; then break; fi
    shift 2
    ;;
    --timeout=*)
    TIMEOUT="${1#*=}"
    shift 1
    ;;
    --)
    shift
    break
    ;;
    --help)
    usage 0
    ;;
    *)
    echoerr "Unknown argument: $1"
    usage 1
    ;;
  esac
done

if [ "$HOST" = "" -o "$PORT" = "" ]; then
  echoerr "Error: you need to provide a host and port to test."
  usage 2
fi

wait_for "$@"

download-jrebel.sh

if [ -z ${JREBEL} ]; then
  echo "Set the JREBEL argument to download and use JRebel remoting inside the container"
else
  apk --no-cache add wget unzip
  wget http://dl.zeroturnaround.com/jrebel-stable-nosetup.zip
  unzip jrebel-stable-nosetup.zip
fi