This topic lists and describes the Dockerfile.dn file from the Hello World Docker demonstration. 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 # This sample code is supplied for demonstration purposes only
003 # on an "as is" basis and is for use at your own risk.
004
005 ARG MFPRODBASE=
006 ARG DTAG=win_5.0
007 FROM microfocus/vcbuildtools-build:${DTAG} as build-env
008
009 LABEL com.microfocus.is-example="true"
010
011 ARG Platform=AnyCPU
012 ARG Config=Release
013
014 # Copy the src folder to c:\src in the container
015 COPY src "c:\\src"
016 WORKDIR "c:\\src"
017
018 # build source using the msbuild project with a output directory of c\app
019 ENV BLDPlatform ${Platform}
020 ENV BLDConfig ${Config}
021 RUN msbuild /p:OutDir=c:\app /p:Configuration=%BLDConfig%;Platform=%BLDPlatform% DNHelloWorld.cblproj
022
023 # Build runtime image for development or production
024 FROM ${MFPRODBASE}
025 WORKDIR "c:\\app"
026 COPY --from=build-env "c:\\app" "c:\\app"
027 ENTRYPOINT ["DNHelloWorld.exe"]
The commands on the lines in this Dockerfile are as follows:
Lines | Description |
---|---|
005 | Defines the MFPRODBASE build argument passed by the
docker build command.
This argument specifies the Visual COBOL base image for use later in this Dockerfile. |
006 - 007 | Specifies that the base image to use is the "build" version of the Visual COBOL base image, and gives the name "build-env" for this build stage. |
009 | Specify the metadata labels for the image that will be created. These labels can be queried using the docker inspect command. |
011 - 012 | Define build arguments passed by the
docker build command:
|
015 - 016 | Copy the Hello World source files to a folder in the image's filesystem and set this folder to be the Docker working directory. |
019 - 021 | Build the Hello World application, putting the build output in c:\app. |
024 | Specifies the start of a new build stage that uses the Visual COBOL base image (as specified by the MFPRODBASE) build argument). |
025 - 026 | Sets the Docker working directory to be c:\app then copies the files from the "build-env" build stage into it. |
027 | Specifies that running the image runs the Hello World application. |