2016-04-15 9 views
8

C++で完全に書かれたコードベースのビルドをサポートするDockerコンテナをセットアップしたいと思います。生成されたアプリケーションはWindowsのみで動作します。DockerのMicrosoftコンパイラ

この目的のために、現在のビルド環境を複製してビルドをサポートするコンテナをセットアップする必要があります。

私はこのような容器を構築するには、以下のようなDockerfileのものを作成する必要が

擬似コードDockerfileの一種として、次の点を考慮してください(ツールをインストールするには、Windowsでのapt-getと考える他のユーティリティを無視

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'] 

注:コマンドライン)から私たちは、ビルドを実行するために我々の組織でカスタムビルドシステム(およびGNU Makeを使用していない)を持っています。私はデバッグ実行可能ファイルをビルドしたいので、デバッグはビルドシステムに提供されるターゲットです。やる私はVisualStudioをコンパイラ(またはWindows上で動作する他のコンパイラ)をインストール方法

  1. どのように私は SigningToolをホストん:

    がある疑問CompressionToolなど実行ファイルドッカー信頼できるレジストリ;可能かどうか

  2. 上記のツールののライセンスをでどうやって処理しますか(コンパイラ、signingtool、compressiontoolはすべてライセンスを実行する必要があります)。

上記は私たちの組織では絶対に問題ありません。 しかし、マシンをセットアップするプロセス(インストールと上記のすべてのツールには多くの時間と労力がかかります)。 したがって、私は裸のマシンに配備できるDockerイメージを作成したいと考えています。これはビルド環境全体をセットアップし、非常に短い時間で実行します。

これを行うより重要な目的は、連続配信の方法論を採用することです。

あなたの入力を同じにしてください(すべての疑問を考慮してください)。

答えて

1

明確にするためには、Windows用のドッカーが必要です。

そして、私はWindows上でのHyper-V VM上のLinux (アルパイン)ホスト実行しますについてDocker for Mac and Windows Beta、話していない午前:任意のWindowsイメージ、唯一のLinuxイメージを実行しません。

私はDocker for Windows(あなたのWindows10 has the latest Hyper-V featureを提供しました)について話しています。ごく最近まで、これはWindows Server 2016 TP4でのみ可能でした。

2

Windowsコンテナを実行できるとします。ここでdocker run -it microsoft/windowsservercore

は、Visual CがChocolatey使用ドッカーコンテナにツール2015を構築++をインストールするために私Dockerfileです:チョコを使用して

# 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" ] 

を簡単ですが、あなたはネイティブウェブをダウンロードすると、同じ結果を得ることができますインストーラを実行し、自動モードで実行してください。たとえば、

visualcppbuildtools_full.exe /Q /L <LogFile> /Full 
0

回答Oあなたの最初のポイントのみ: Install Build Tools into a Container

私は、Windows Server 2016上でドッカーを実行し、そのターゲットのレガシーアプリケーションをコンパイルしています:私はWindowsのC++アプリケーションをコンパイルするためにドッカーイメージの出発点として使用し、ここで文書がありますXP。

私の最終的なDockerfileはこのように見えた:

# Use the latest Windows Server Core image. 
FROM microsoft/windowsservercore 

# Download the Visual Studio 2017 installer outside of the PATH. 
# This is required for Windows SDK 7.1A (XP targetting) 
ADD https://aka.ms/vs/15/release/vs_professional.exe C:\\TEMP\\vs_professional.exe 

# Add C:\Bin to PATH and install Build Tools with components we need 
RUN setx /m PATH "%PATH%;C:\Bin" \ 
&& C:\TEMP\vs_professional.exe --quiet --wait --norestart --nocache \ 
    --add Microsoft.VisualStudio.Component.Static.Analysis.Tools \ 
    --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 \ 
    --add Microsoft.VisualStudio.Component.VC.CMake.Project \ 
    --add Microsoft.VisualStudio.Component.VC.CoreBuildTools \ 
    --add Microsoft.VisualStudio.Component.VC.ATLMFC \ 
    --add Microsoft.VisualStudio.Component.VC.ATL \ 
    --add Microsoft.VisualStudio.Component.Windows10SDK.16299.Desktop \ 
    --add Microsoft.VisualStudio.Component.Windows10SDK.16299.UWP \ 
    --add Microsoft.VisualStudio.Component.Windows10SDK.16299.UWP.Native \ 
    --add Microsoft.VisualStudio.Component.Windows10SDK \ 
    --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Win81 \ 
    --add Microsoft.VisualStudio.Component.VC.Redist.14.Latest \ 
    --add Microsoft.Component.VC.Runtime.UCRTSDK \ 
    --add Microsoft.VisualStudio.Component.WinXP \ 
|| IF "%ERRORLEVEL%"=="3010" EXIT 0 

# Start developer command prompt with any other commands specified. 
ENTRYPOINT "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools\VsDevCmd.bat" && 

# Default to PowerShell if no other command specified. 
CMD ["powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"] 
関連する問題