This topic lists and describes the Dockerfile.nojava file from the Docker demonstration for the Visual COBOL 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 ARG BASE_SUFFIX= 004 FROM microsoft/dotnet-framework${BASE_SUFFIX} 005 006 # PRODUCT_VERSION is product version associated with this Dockerfile 007 # MFLICFILE is the build-arg for the license filename 008 # ACCEPT_CONTAINER_EULA is the build-arg for the accepting the end user license argument 009 # SETUP_EXE is the build-arg name for installer exe to be used 010 # TOOLS_LOC is build-arg name for installation location of the tools 011 ARG PRODUCT_VERSION=a.b.cc 012 ARG MFLICFILE 013 ARG ACCEPT_CONTAINER_EULA=no 014 ARG SETUP_EXE=vcbt_40.exe 015 ARG TOOLS_LOC=c:\\VCTools 016 ARG TMP_INST_DIR=c:\\vc40tmp 017 018 LABEL vendor="Micro Focus" \ 019 com.microfocus.name="Visual COBOL" \ 020 com.microfocus.version="$PRODUCT_VERSION" \ 021 com.microfocus.eula.url="https://supportline.microfocus.com/licensing/agreements.aspx" \ 022 com.microfocus.is-base-image="true" \ 023 024 # transfer build arguments to environment vars 025 ENV TOOLS_LOC=${TOOLS_LOC} \ 026 RMT_DIR="C:\\Program Files (x86)\\Common Files\\SafeNet Sentinel\\Sentinel RMS License Manager\\WinNT" 027 028 # Use cmd.exe, the microsoft/dotnet-framework-build changes this to powershell, so we need to reset 029 SHELL ["cmd", "/S", "/C"] 030 031 # Copy the setup .exe and license to the image 032 COPY ${SETUP_EXE} "${TMP_INST_DIR}\\" 033 COPY ${MFLICFILE} "${TOOLS_LOC}\\" 034 035 # Do the actual installation 036 RUN set TMP_INST_DIR=${TMP_INST_DIR} && \ 037 set SETUP_EXE=${SETUP_EXE} && \ 038 set ACCEPT_CONTAINER_EULA=${ACCEPT_CONTAINER_EULA} && \ 039 cd %TMP_INST_DIR% && start "" /wait %SETUP_EXE% /q "InstallFolder=%TOOLS_LOC%" /l log.txt accepteula=%ACCEPT_CONTAINER_EULA% 040 041 # Check log.txt 042 RUN cd %TMP_INST_DIR% && \ 043 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) 044 045 # License the image 046 RUN set TOOLS_LOC=${TOOLS_LOC} && \ 047 set MFLICFILE=${MFLICFILE} && \ 048 cd %TOOLS_LOC% && \ 049 "%RMT_DIR%\\MFLicenseAdmin.exe" -install %MFLICFILE% 050 051 # Cleaup directory 052 RUN set TMP_INST_DIR=${TMP_INST_DIR} && \ 053 cd \ && rmdir /S /Q %TMP_INST_DIR% 054 055 # set the default directory to tools directory 056 WORKDIR "${TOOLS_LOC}"
The commands on the lines in this Dockerfile are as follows:
Lines | Description |
---|---|
003 - 004 | Specifies that the base image to use is the official Docker image for .NET Framework on Windows Server 2016 Server Core. |
011 - 016 |
Define build arguments passed by the
docker build command:
Note: Unlike
Dockerfile,
Dockerfile.nojava does not need to define the arguments JAVATARFILE and JAVAHOMEDIR.
|
018 - 022 | Specify the metadata labels for the image that will be created. These labels can be queried using the
docker inspect command.
Note: Unlike
Dockerfile,
Dockerfile.nojava does not need to include an entry for
com.microfocus.third_parties.java.
|
025 - 026 | Create environment variables to be used in this Dockerfile:
Note: Unlike
Dockerfile,
Dockerfile.nojava does not need to define the arguments JAVA_PKG and JAVA_HOME.
|
029 |
Specifies that the shell to be used for subsequent instructions is
["cmd", "/S", "/C"].
This is the default for Dockerfiles on Windows but needs to be specified explicitly here because the base image for this Dockerfile is a Microsoft .NET Framework "-build" image, and using that image causes PowerShell to be used as the shell. |
032 - 033 | Copies the Visual COBOL installation file into the temporary folder and the Visual COBOL license file into the folder where Visual COBOL is to be installed. |
036 - 039 | Run the Visual COBOL 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. |
042 - 043 | Runs a series of concatenated Windows commands to search the Visual COBOL installation log file for text indicating that the installation failed. If any such text is found no further processing takes place. |
046 - 049 | Runs a series of concatenated Windows commands to license Visual COBOL. |
052 - 053 | Runs a series of concatenated Windows commands to delete the Visual COBOL installation file and the temporary directory that was used to contain it. |
056 | Sets the Docker working directory to be the directory into which Visual COBOL was installed. |