Skip to content

Commit

Permalink
Add windows build tools
Browse files Browse the repository at this point in the history
  • Loading branch information
friism committed Oct 24, 2016
1 parent 5c3577f commit 50fdd45
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 0 deletions.
6 changes: 6 additions & 0 deletions update.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
docker build -f .\windows\Dockerfile.build -t builder .\windows\.
docker create --name out builder
docker cp out:hello.exe .\windows\.
docker rm out
docker build -t hello-world:windows .\windows\.
docker run hello-world:windows
3 changes: 3 additions & 0 deletions windows/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM microsoft/nanoserver
COPY hello.exe /
CMD ["hello.exe"]
18 changes: 18 additions & 0 deletions windows/Dockerfile.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM microsoft/windowsservercore

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]

RUN Install-WindowsFeature NET-Framework-45-Core
RUN Invoke-WebRequest "https://download.microsoft.com/download/5/f/7/5f7acaeb-8363-451f-9425-68a90f98b238/visualcppbuildtools_full.exe" \
-OutFile visualcppbuildtools_full.exe -UseBasicParsing ; \
Start-Process -FilePath 'visualcppbuildtools_full.exe' -ArgumentList '/quiet', '/NoRestart' -Wait ; \
Remove-Item .\visualcppbuildtools_full.exe

RUN [Environment]::SetEnvironmentVariable('PATH', ${Env:ProgramFiles(x86)} + '\Microsoft Visual Studio 14.0\VC\bin\amd64;' + ${Env:ProgramFiles(x86)} + '\Windows Kits\10\bin\x64;' + $env:PATH, [EnvironmentVariableTarget]::Machine);

RUN pushd 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC' ; \
cmd /c 'vcvarsall.bat amd64&set' | foreach { if ($_ -match '=') { $v = $_.split('='); setx /M $v[0] $v[1] } } ; \
popd

ADD hello.c .
RUN cl /D_WIN32_WINNT=0x0A00 /D_WINVER=0x0A00 hello.c
31 changes: 31 additions & 0 deletions windows/hello.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include<stdio.h>

const char message[] =
"\n"
"Hello from Docker!\n"
"This message shows that your installation appears to be working correctly.\n"
"\n"
"To generate this message, Docker took the following steps:\n"
" 1. The Docker client contacted the Docker daemon.\n"
" 2. The Docker daemon pulled the \"hello-world\" image from the Docker Hub.\n"
" 3. The Docker daemon created a new container from that image which runs the\n"
" executable that produces the output you are currently reading.\n"
" 4. The Docker daemon streamed that output to the Docker client, which sent it\n"
" to your terminal.\n"
"\n"
"To try something more ambitious, you can run an Nanoserver container with:\n"
" > docker run -it microsoft/nanoserver powershell\n"
"\n"
"Share images, automate workflows, and more with a free Docker Hub account:\n"
" https://hub.docker.com\n"
"\n"
"For more examples and ideas, visit:\n"
" https://docs.docker.com/engine/userguide/\n"
"\n";


int main()
{
printf(message);
return 0;
}

0 comments on commit 50fdd45

Please sign in to comment.