The Dockerfile File in the Docker Demonstration for the Enterprise Server Base Image

This topic lists and describes the Dockerfile file from the Docker demonstration for the Enterprise Server base image. The Dockerfile is listed in its entirety and a following table describes the various Dockerfile commands. The line numbers in the listings of the Dockerfile have been added to aid readability. They are not present in the supplied Dockerfile.

001  # Copyright (C) Micro Focus 2018. All rights reserved. 
002  
003  FROM microsoft/dotnet-framework
004  
005  # PRODUCT_VERSION is product version associated with this Dockerfile
006  # ACCEPT_CONTAINER_EULA is the build-arg name for the accepting the end user license agreement
007  # ENTSRV_EXE is the build-arg name name of installer to used
008  # ENTSRV_LOC is the build-arg name for the installation location
009  # MFLICFILE is the build-arg name for the license filename
010  ARG PRODUCT_VERSION=4.0.00232
011  ARG ACCEPT_CONTAINER_EULA=no
012  ARG ENTSRV_EXE=es_40.exe
013  ARG ENTSRV_LOC=c:\\es
014  ARG TMP_INST_DIR=c:\\es40tmp
015  ARG MFLICFILE
016  
017  LABEL vendor="Micro Focus" \
018        com.microfocus.name="Enterprise Server" \
019        com.microfocus.version="$PRODUCT_VERSION" \
020        com.microfocus.eula.url="https://supportline.microfocus.com/licensing/agreements.aspx" \
021        com.microfocus.is-base-image="true"
022  
023  # transfer build arguments to environment vars
024  ENV RMT_DIR C:\\Program Files (x86)\\Common Files\\SafeNet Sentinel\\Sentinel RMS License Manager\\WinNT
025  ENV ENTSRV_LOC=${ENTSRV_LOC}
026  
027  WORKDIR "$TMP_INST_DIR"
028  COPY ${ENTSRV_EXE} ${TMP_INST_DIR}
029  RUN set ENTSRV_EXE=${ENTSRV_LOC} && \
030      set TMP_INST_DIR=${TMP_INST_DIR} && \
031      set ACCEPT_CONTAINER_EULA=${ACCEPT_CONTAINER_EULA} && \
032      mkdir %ENTSRV_LOC% && \
033      cd %TMP_INST_DIR% && \
034      start "" /wait %ENTSRV_EXE% /q "InstallFolder=%ENTSRV_LOC%" /l log.txt accepteula=%ACCEPT_CONTAINER_EULA%
035  
036  # Check log.txt
037  RUN findstr /ic:"Exit Code: 0x0" log.txt || (echo "Install failed - error messages in log.txt" && findstr /ic:"error" log.txt && findstr /ic:"Exit Code:" log.txt && exit 1)
038  
039  # copy .mflic to the ent srv directory
040  COPY ${MFLICFILE} "${ENTSRV_LOC}\\"
041  
042  # license the server
043  RUN set MFLICFILE=${MFLICFILE} && \
044      cd %ENTSRV_LOC% && \
045      echo Using license file %MFLICFILE% && \
046     "%RMT_DIR%\\MFLicenseAdmin.exe" -install %MFLICFILE%
047  
048  # Cleaup directory
049  RUN set TMP_INST_DIR=${TMP_INST_DIR} && \
050      cd \ && \
051      rmdir /S /Q %TMP_INST_DIR%
052  
053  WORKDIR "${ENTSRV_LOC}"

The commands on the lines in this Dockerfile are as follows:

Lines Description
003 Specifies that the base image to use is the official Docker image for .NET Framework on Windows Server 2016 Server Core.
010 - 015 Define build arguments passed by the docker build command:
  • PRODUCT_VERSION. Indicates the version of Enterprise Server that this Dockerfile is supplied with.
  • ACCEPT_CONTAINER_EULA. Indicates acceptance of the terms laid out in the license agreement. The default setting of "no" means that you must modify this in order to indicate that you accept the terms of the license agreement.
  • ENTSRV_EXE. Specifies the name of the Enterprise Server installation file. The default setting is the name of the file supplied with Enterprise Server.
  • ENTSRV_LOC. Specifies the folder into which Enterprise Server will be installed.
  • TMP_INST_DIR. Specifies a temporary directory to be used while building the image. It is deleted when it is no longer needed.
  • MFLICFILE. Specifies the name of the license file to use for Enterprise Server.
017 - 021 Specify the metadata labels for the image that will be created. These labels can be queried using the docker inspect command.
024 - 025 Create environment variables to be used in this Dockerfile:
  • RMT_DIR specifies the location of the COBOL licensing management software. This is installed when you install Enterprise Server.
  • ENTSRV_LOC is copied from the build argument of the same name that was defined earlier.
027 - 028 Sets the Docker working directory to be the temporary directory then copies the Enterprise Server installation file into it.
029 - 034 Run a series of concatenated Windows commands to:
  1. Set some environment variables based on the settings of build arguments.
  2. Run the Enterprise Server installation file specifying parameters to install it silently, into the required directory, creating a log file, and indicating that you have accepted the terms laid out in the license agreement.
037 Runs a series of concatenated Windows commands to search the Enterprise Server installation log file for text indicating that the installation failed. If any such text is found no further processing takes place.
040 - 046 Run a series of concatenated Windows commands to license Enterprise Server.
049 - 051 Runs a series of concatenated Windows commands to delete the Enterprise Server installation file and the temporary directory that was used to contain it.
053 Sets the Docker working directory to be the directory into which Enterprise Server was installed.