Microsoft Compiler in Docker

I want to setup a Docker container to support builds of the code base which is entirely written in C++, and the generated application runs on Windows only.

For this purpose, I need to setup a container replicating our current build environment to support the builds.

  • Deploy a .war into a Docker image by fabric8io docker-maven-plugin
  • Docker Swarm that uses just nodes? [duplicate]
  • Docker container not accessible in host machine
  • How to configure NGINX routes?
  • RabbitMQ on Docker: Permission denied when chown-ing erlang cookie
  • AWS beanstalk environment isn't rotating docker container logs
  • I need to create a Dockerfile something like below to build such a container:

    Please consider the following as kind of pseudo-code Dockerfile(ignore the apt-get and consider any other utility in windows to install tools from command line):

    FROM: Windows10 // A base windows kernel 
    
    RUN apt-get install -y VisualStudio // Installing the Visual Studio for compilation of C++ files
    
    RUN apt-get install -y cygwin // Since I am using some cygwin utlities in build process
    
    RUN apt-get install -y SigningTool // A tool I need to sign the exe
    
    RUN apt-get install -y CompressionTool // A tool I need to compress the exe
    
    RUN apt-get install -y BuildSystem // Custom in-house build system to generate the builds of the source code
    
    CMD ['BuildSystem debug']
    

    Note: We have a custom build system ( and not using GNU Make) in our organization to perform the builds. debug is the target provided to the build system, since I want to build a debug executable.

    My doubts are:

    1. How do I install a VisualStudio compiler ( or any other compiler that runs on windows)

    2. How do I host the SigningTool , CompressionTool and other executables (on Docker Trusted Registry; whether is it possible to host the executables on DTR)

    3. How do I take care of the licensing of the above tools (compiler, signingtool, compressiontool all require licenses to run).

    The above works absolutely fine in our organization.
    But the process of setting up a machine (installation and all of the above tools takes a lot of time and effort).
    Hence, I want to create a Docker image that can be deployed on a bare machine, which will have the whole build environment setup and running in very less time.

    A more important purpose of doing so is to adopt the Continuous Delivery methodology.

    Please provide your inputs on the same(try to consider all the doubts).

  • How to register EC2 Instance to ECS cluster?
  • docker-compose up gives error: bash: sails: command not found
  • Which one should i use? docker kill or docker stop?
  • TravisCI build succeeds even when tests fail
  • docker stop command not working correctly
  • Using Docker with Sensu
  • 2 Solutions collect form web for “Microsoft Compiler in Docker”

    Just to be clear, you would need docker for Windows for this.

    And I am not talking about Docker for Mac and Windows Beta, which would run a Linux (Alpine) host on a Hyper-V VM on Windows: that would not run any Windows image, only Linux images.

    I am talking about Docker for Windows (provided your Windows10 has the latest Hyper-V feature). Up to very recently, that was only possible on a Windows Server 2016 TP4.

    I assume you can already run Windows containers, ex. docker run -it microsoft/windowsservercore

    Here is my Dockerfile to install Visual C++ Build Tools 2015 in Docker container using Chocolatey:

    # escape=`
    
    FROM microsoft/windowsservercore
    
    # Install chocolatey
    RUN @powershell -NoProfile -ExecutionPolicy unrestricted -Command "(iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))) >$null 2>&1"
    
    # Install Visual C++ Build Tools, as per: https://chocolatey.org/packages/visualcpp-build-tools
    RUN choco install visualcpp-build-tools -version 14.0.25420.1 -y
    
    # Add msbuild to PATH
    RUN setx /M PATH "%PATH%;C:\Program Files (x86)\MSBuild\14.0\bin"
    
    # Test msbuild can be accessed without path
    RUN msbuild -version
    
    CMD [ "cmd.exe" ]
    

    Using Choco is simpler, but you can get the same result with downloading native web installer and running it in quiet mode, for example:

    visualcppbuildtools_full.exe /Q /L <LogFile> /Full
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.