This topic lists and describes the Dockerfile file from the Docker demonstration for the Enterprise Test 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 # ETSTSRV_EXE is the build-arg name name of installer to used
008 # ETSTSRV_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 ETSTSRV_LOC=c:\\es
013 ARG TMP_INST_DIR=c:\\es40tmp
014 ARG ETSTSRV_EXE=ets_40.exe
015 ARG MFLICFILE
016 LABEL vendor="Micro Focus" \
017 com.microfocus.name="Enterprise Server Test" \
018 com.microfocus.version="$PRODUCT_VERSION" \
019 com.microfocus.eula.url="https://supportline.microfocus.com/licensing/agreements.aspx" \
020 com.microfocus.is-base-image="true"
021
022 # transfer build arguments to environment vars
023 ENV RMT_DIR C:\\Program Files (x86)\\Common Files\\SafeNet Sentinel\\Sentinel RMS License Manager\\WinNT
024 ENV ETSTSRV_LOC=${ETSTSRV_LOC}
025
026 WORKDIR "$TMP_INST_DIR"
027 COPY ${ETSTSRV_EXE} "${TMP_INST_DIR}\\"
028 RUN set ETSTSRV_EXE=${ETSTSRV_EXE} && \
029 set TMP_INST_DIR=${TMP_INST_DIR} && \
030 set ACCEPT_CONTAINER_EULA=${ACCEPT_CONTAINER_EULA} && \
031 mkdir %ETSTSRV_LOC% && \
032 cd %TMP_INST_DIR% && \
033 start "" /wait %ETSTSRV_EXE% /q "InstallFolder=%ETSTSRV_LOC%" /l log.txt accepteula=%ACCEPT_CONTAINER_EULA%
034
035 # Check log.txt
036 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)
037
038 # copy .mflic to the ent srv directory
039 COPY ${MFLICFILE} "${ETSTSRV_LOC}\\"
040
041 # license the server
042 RUN set MFLICFILE=${MFLICFILE} && \
043 cd %ETSTSRV_LOC% && \
044 echo Using license file %MFLICFILE% && \
045 "%RMT_DIR%\\MFLicenseAdmin.exe" -install %MFLICFILE%
046
047 # Cleaup directory
048 RUN set TMP_INST_DIR=${TMP_INST_DIR} && \
049 cd \ && \
050 rmdir /S /Q %TMP_INST_DIR%
051
052 WORKDIR "${ETSTSRV_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:
|
| 016 - 020 | Specify the metadata labels for the image that will be created. These labels can be queried using the docker inspect command. |
| 023 - 024 | Create environment variables to be used in this Dockerfile:
|
| 026 - 027 | Sets the Docker working directory to be the temporary directory then copies the Enterprise Test Server installation file into it. |
| 028 - 033 | Run a series of concatenated Windows commands to:
|
| 036 | Runs a series of concatenated Windows commands to search the Enterprise Test Server installation log file for text indicating that the installation failed. If any such text is found no further processing takes place. |
| 039 | Copies the license file into the folder where Enterprise Test Server is to be installed. |
| 042 - 045 | Run a series of concatenated Windows commands to license Enterprise Test Server. |
| 048 - 050 | Runs a series of concatenated Windows commands to delete the Enterprise Test Server installation file and the temporary directory that was used to contain it. |
| 052 | Sets the Docker working directory to be the directory into which Enterprise Test Server was installed. |