This commit is contained in:
Mark Harris 2018-07-22 16:36:45 -04:00
Родитель 56972e461c
Коммит 2f14373a19
2 изменённых файлов: 64 добавлений и 12 удалений

Просмотреть файл

@ -1,15 +1,67 @@
# escape=` # USAGE NOTES:
FROM microsoft/windowsservercore #
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] # Step 1)
# Docker => Settings => Daemon => Switch from Basic to Advanced
# Add :
# "storage-opts": [
# "size=120GB"
# ]
#
# Step 2)
# docker image build -t vs2017/buildtools -m 2GB .
#
# References:
# https://docs.microsoft.com/en-us/visualstudio/install/build-tools-container
# https://docs.microsoft.com/en-us/visualstudio/install/use-command-line-parameters-to-install-visual-studio
# https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools
#
# NOTE: this build takes ~01:21:17.3328007 hrs on a surface book 2 15" with 16 GB RAM
# and results in an image size of 56.8GB
#
RUN Install-PackageProvider -Name chocolatey -RequiredVersion 2.8.5.130 -Force; `
Install-Package -Name microsoft-build-tools -RequiredVersion 15.0.26228.0 -Force; `
Install-Package -Name netfx-4.5.2-devpack -RequiredVersion 4.5.5165101 -Force
RUN Install-Package nuget.commandline -RequiredVersion 3.5.0 -Force; ` # Use the latest Windows Server Core image
& C:\Chocolatey\bin\nuget install Microsoft.Data.Tools.Msbuild -Version 10.0.61026 FROM microsoft/windowsservercore:latest
ENV MSBUILD_PATH="C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin"
RUN $env:PATH = $env:MSBUILD_PATH + ';' + $env:PATH; ` # Download the tools
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine) SHELL ["cmd", "/S", "/C"]
ADD "https://aka.ms/vs/15/release/vs_buildtools.exe" "C:\TEMP\vs_buildtools.exe"
ADD "https://dist.nuget.org/win-x86-commandline/v4.7.0/nuget.exe" "C:\TEMP\nuget.exe"
# Install VS 2017 Build Tools
RUN C:\TEMP\vs_buildtools.exe --includeRecommended --includeOptional --quiet --nocache --norestart --wait \
--installPath C:\BuildTools \
--all \
--remove Microsoft.VisualStudio.Component.Windows10SDK.10240 \
--remove Microsoft.VisualStudio.Component.Windows10SDK.10586 \
--remove Microsoft.VisualStudio.Component.Windows10SDK.14393 \
--remove Microsoft.VisualStudio.Component.Windows81SDK \
|| IF "%ERRORLEVEL%"=="3010" EXIT 0
# Install SSDT NuGet
RUN "C:\TEMP\nuget.exe" install Microsoft.Data.Tools.Msbuild -Version 10.0.61804.210
# Install Chocolatey
ENV chocolateyUseWindowsCompression = false
SHELL ["powershell.exe", "-ExecutionPolicy", "Bypass", "-Command"]
RUN Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')); \
[System.Environment]::SetEnvironmentVariable('PATH', "\"${env:PATH};%ALLUSERSPROFILE%\chocolatey\bin\"", 'Machine'); \
choco feature enable -n allowGlobalConfirmation;
# Install git tools with chocolatey
RUN choco install git -y \
git-lfs -y \
git-credential-manager-for-windows -y
# Launch VS2017 developer command prompt when started
SHELL ["cmd", "/S", "/C"]
ENTRYPOINT [ "CMD", "/k", "C:/BuildTools/Common7/Tools/VsDevCmd.bat" ]

Просмотреть файл

@ -1,6 +1,6 @@
# Part 1 - build the dacpac # Part 1 - build the dacpac
docker build -t assets-db-builder -f Dockerfile.builder . docker image build -t assets-db-builder -m 2GB -f Dockerfile.builder .
rmdir -Force -Recurse out rmdir -Force -Recurse out
mkdir out mkdir out
docker run --rm -v $pwd\out:c:\bin -v $pwd\src:c:\src assets-db-builder docker run --rm -v $pwd\out:c:\bin -v $pwd\src:c:\src assets-db-builder