github.com/vieux/docker@v0.6.3-0.20161004191708-e097c2a938c7/Dockerfile.windows (about) 1 # This file describes the standard way to build Docker, using a docker container on Windows 2 # Server 2016 3 # 4 # Usage: 5 # 6 # # Assemble the full dev environment. This is slow the first time. Run this from 7 # # a directory containing the sources you are validating. For example from 8 # # c:\go\src\github.com\docker\docker 9 # 10 # docker build -t docker -f Dockerfile.windows . 11 # 12 # 13 # # Build docker in a container. Run the following from a Windows cmd command prommpt, 14 # # replacing c:\built with the directory you want the binaries to be placed on the 15 # # host system. 16 # 17 # docker run --rm -v "c:\built:c:\target" docker sh -c 'cd /c/go/src/github.com/docker/docker; hack/make.sh binary; ec=$?; if [ $ec -eq 0 ]; then robocopy /c/go/src/github.com/docker/docker/bundles/$(cat VERSION)/binary /c/target/binary; fi; exit $ec' 18 # 19 # Important notes: 20 # --------------- 21 # 22 # The posix utilities from GIT aren't usable interactively as at January 2016. This 23 # is because they require a console window which isn't present in a container in Windows. 24 # See the example at the top of this file. Do NOT use -it in that docker run!!! 25 # 26 # Don't try to use a volume for passing the source through. The posix utilities will 27 # balk at reparse points. Again, see the example at the top of this file on how use a volume 28 # to get the built binary out of the container. 29 # 30 # The steps are minimised dramatically to improve performance 31 32 FROM windowsservercore 33 34 # Environment variable notes: 35 # - GO_VERSION must consistent with 'Dockerfile' used by Linux'. 36 # - FROM_DOCKERFILE is used for detection of building within a container. 37 ENV GO_VERSION=1.7.1 \ 38 GIT_LOCATION=https://github.com/git-for-windows/git/releases/download/v2.7.2.windows.1/Git-2.7.2-64-bit.exe \ 39 GOPATH=C:/go;C:/go/src/github.com/docker/docker/vendor \ 40 FROM_DOCKERFILE=1 41 42 WORKDIR c:/ 43 44 # Everything downloaded/installed in one go (better performance, esp on TP4) 45 RUN \ 46 setx /M Path "c:\git\cmd;c:\git\bin;c:\git\usr\bin;%Path%;c:\gcc\bin;c:\go\bin" && \ 47 setx GOROOT "c:\go" && \ 48 powershell -command \ 49 $ErrorActionPreference = 'Stop'; \ 50 Function Download-File([string] $source, [string] $target) { \ 51 $wc = New-Object net.webclient; $wc.Downloadfile($source, $target) \ 52 } \ 53 \ 54 Write-Host INFO: Downloading git...; \ 55 Download-File %GIT_LOCATION% gitsetup.exe; \ 56 \ 57 Write-Host INFO: Downloading go...; \ 58 Download-File https://storage.googleapis.com/golang/go%GO_VERSION%.windows-amd64.msi go.msi; \ 59 \ 60 Write-Host INFO: Downloading compiler 1 of 3...; \ 61 Download-File https://raw.githubusercontent.com/jhowardmsft/docker-tdmgcc/master/gcc.zip gcc.zip; \ 62 \ 63 Write-Host INFO: Downloading compiler 2 of 3...; \ 64 Download-File https://raw.githubusercontent.com/jhowardmsft/docker-tdmgcc/master/runtime.zip runtime.zip; \ 65 \ 66 Write-Host INFO: Downloading compiler 3 of 3...; \ 67 Download-File https://raw.githubusercontent.com/jhowardmsft/docker-tdmgcc/master/binutils.zip binutils.zip; \ 68 \ 69 Write-Host INFO: Installing git...; \ 70 Start-Process gitsetup.exe -ArgumentList '/VERYSILENT /SUPPRESSMSGBOXES /CLOSEAPPLICATIONS /DIR=c:\git\' -Wait; \ 71 \ 72 Write-Host INFO: Installing go..."; \ 73 Start-Process msiexec -ArgumentList '-i go.msi -quiet' -Wait; \ 74 \ 75 Write-Host INFO: Unzipping compiler...; \ 76 c:\git\usr\bin\unzip.exe -q -o gcc.zip -d /c/gcc; \ 77 c:\git\usr\bin\unzip.exe -q -o runtime.zip -d /c/gcc; \ 78 c:\git\usr\bin\unzip.exe -q -o binutils.zip -d /c/gcc"; \ 79 \ 80 Write-Host INFO: Removing interim files; \ 81 Remove-Item *.zip; \ 82 Remove-Item go.msi; \ 83 Remove-Item gitsetup.exe; \ 84 \ 85 Write-Host INFO: Completed 86 87 # Prepare for building 88 COPY . /go/src/github.com/docker/docker 89