This topic lists and describes the Dockerfile file from the Docker demonstration for the COBOL 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 2019. 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 # SETUP_EXE is the build-arg name name of installer to used 008 # COBSRV_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=5.0.00252 011 ARG ACCEPT_CONTAINER_EULA=no 012 ARG SETUP_EXE=cs_50.exe 013 ARG COBSRV_LOC=c:\\cobolrts 014 ARG MFLICFILE 015 ARG TMP_INST_DIR=c:\\cs50tmp 016 017 LABEL vendor="Micro Focus" \ 018 com.microfocus.name="COBOL 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 COBSRV_LOC=${COBSRV_LOC} \ 025 RMT_DIR="C:\\Program Files (x86)\\Common Files\\SafeNet Sentinel\\Sentinel RMS License Manager\\WinNT" 026 027 WORKDIR "${TMP_INST_DIR}" 028 COPY ${SETUP_EXE} "${TMP_INST_DIR}\\" 029 030 RUN set ACCEPT_CONTAINER_EULA=${ACCEPT_CONTAINER_EULA} && \ 031 set SETUP_EXE=${SETUP_EXE} && \ 032 start "" /wait %SETUP_EXE% /q "InstallFolder=%COBSRV_LOC%" /l log.txt accepteula=%ACCEPT_CONTAINER_EULA% 033 034 # Check log.txt 035 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) 036 037 # Cleaup directory 038 RUN set TMP_INST_DIR=${TMP_INST_DIR} && \ 039 del *.exe && \ 030 cd \ && rmdir /S /Q %TMP_INST_DIR% 041 042 # set working directory to be the COBOL Server install location 043 WORKDIR "${COBSRV_LOC}" 044 045 # license it 046 COPY ${MFLICFILE} "${COBSRV_LOC}\\" 047 RUN set MFLICFILE=${MFLICFILE} && \ 048 "%RMT_DIR%\\MFLicenseAdmin.exe" -install %MFLICFILE%
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:
|
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:
|
027 - 028 | Sets the Docker working directory to be the temporary directory then copies the COBOL Server installation file into it. |
030 - 032 | Run a series of concatenated Windows commands to:
|
035 | Runs a series of concatenated Windows commands to search the COBOL Server installation log file for text indicating that the installation failed. If any such text is found no further processing takes place. |
038 - 040 | Runs a series of concatenated Windows commands to delete the COBOL Server installation file and the temporary directory that was used to contain it. |
043 | Sets the Docker working directory to be the directory into which COBOL Server was installed. |
046 - 048 | Run a series of concatenated Windows commands to license COBOL Server. |