The Dockerfile.x86 File in the Docker Demonstration for the Visual COBOL Base Image

This topic lists and describes the Dockerfile.x86 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 DTAGVER=
004  ARG BASE_SUFFIX=
005  FROM microfocus/vcbuildtools${BASE_SUFFIX}:${DTAGVER}
006  
007  # copy the powershell script to convert cblpromp -J output to setx command
008  ADD convsetx.ps1 "c:\convsetx.ps1"
009  
010  # ensure msbuild is always on the PATH
011  RUN setx /M PATH "%PATH%;C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319"
012  
013  # convert the output of cblprompt into SETX commands and execute them
014  RUN cd %TOOLS_LOC% && \
015      bin\cblpromp.exe -J >env.prop && \
016      powershell -file "c:\convsetx.ps1" >envsetx.bat && \
017      envsetx.bat && \
018      del envsetx.bat && \
019      del env.prop && \
020      del "c:\convsetx.ps1"

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

Lines Description
003 - 004 Define build arguments passed by the docker build command.
005 Specifies that the base image to use is the image built from Dockerfile.
008 Copies the convsetx.ps1 PowerShell script to the image's filesystem.
011 Updates the PATH environment variable to enable the use of MSBuild.
014 - 020 Run a series of concatenated Windows commands to ensure that all environment variables set by the COBOL command prompt are available to applications in this image.