github.com/hustcat/docker@v1.3.3-0.20160314103604-901c67a8eeab/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 # 'Start-Sleep' is a deliberate workaround for a current problem on containers in Windows 23 # Server 2016. It ensures that the network is up and available for when the command is 24 # network related. This bug is being tracked internally at Microsoft and exists in TP4. 25 # Generally sleep 1 or 2 is probably enough, but making it 5 to make the build file 26 # as bullet proof as possible. This isn't a big deal as this only runs the first time. 27 # 28 # The cygwin posix utilities from GIT aren't usable interactively as at January 2016. This 29 # is because they require a console window which isn't present in a container in Windows. 30 # See the example at the top of this file. Do NOT use -it in that docker run!!! 31 # 32 # Don't try to use a volume for passing the source through. The cygwin posix utilities will 33 # balk at reparse points. Again, see the example at the top of this file on how use a volume 34 # to get the built binary out of the container. 35 # 36 # The steps are minimised dramatically to improve performance (TP4 is slow on commit) 37 38 FROM windowsservercore 39 40 # Environment variable notes: 41 # - GOLANG_VERSION must consistent with 'Dockerfile' used by Linux'. 42 # - FROM_DOCKERFILE is used for detection of building within a container. 43 ENV GOLANG_VERSION=1.6 \ 44 GIT_LOCATION=https://github.com/git-for-windows/git/releases/download/v2.7.2.windows.1/Git-2.7.2-64-bit.exe \ 45 RSRC_COMMIT=ba14da1f827188454a4591717fff29999010887f \ 46 GOPATH=C:/go;C:/go/src/github.com/docker/docker/vendor \ 47 FROM_DOCKERFILE=1 48 49 WORKDIR c:/ 50 51 # Everything downloaded/installed in one go (better performance, esp on TP4) 52 RUN \ 53 setx /M Path "c:\git\cmd;c:\git\bin;c:\git\usr\bin;%Path%;c:\gcc\bin;c:\go\bin" && \ 54 setx GOROOT "c:\go" && \ 55 powershell -command \ 56 $ErrorActionPreference = 'Stop'; \ 57 Start-Sleep -Seconds 5; \ 58 Function Download-File([string] $source, [string] $target) { \ 59 $wc = New-Object net.webclient; $wc.Downloadfile($source, $target) \ 60 } \ 61 \ 62 Write-Host INFO: Downloading git...; \ 63 Download-File %GIT_LOCATION% gitsetup.exe; \ 64 \ 65 Write-Host INFO: Downloading go...; \ 66 Download-File https://storage.googleapis.com/golang/go%GOLANG_VERSION%.windows-amd64.msi go.msi; \ 67 \ 68 Write-Host INFO: Downloading compiler 1 of 3...; \ 69 Download-File https://raw.githubusercontent.com/jhowardmsft/docker-tdmgcc/master/gcc.zip gcc.zip; \ 70 \ 71 Write-Host INFO: Downloading compiler 2 of 3...; \ 72 Download-File https://raw.githubusercontent.com/jhowardmsft/docker-tdmgcc/master/runtime.zip runtime.zip; \ 73 \ 74 Write-Host INFO: Downloading compiler 3 of 3...; \ 75 Download-File https://raw.githubusercontent.com/jhowardmsft/docker-tdmgcc/master/binutils.zip binutils.zip; \ 76 \ 77 Write-Host INFO: Installing git...; \ 78 Start-Process gitsetup.exe -ArgumentList '/VERYSILENT /SUPPRESSMSGBOXES /CLOSEAPPLICATIONS /DIR=c:\git\' -Wait; \ 79 \ 80 Write-Host INFO: Installing go..."; \ 81 Start-Process msiexec -ArgumentList '-i go.msi -quiet' -Wait; \ 82 \ 83 Write-Host INFO: Unzipping compiler...; \ 84 c:\git\usr\bin\unzip.exe -q -o gcc.zip -d /c/gcc; \ 85 c:\git\usr\bin\unzip.exe -q -o runtime.zip -d /c/gcc; \ 86 c:\git\usr\bin\unzip.exe -q -o binutils.zip -d /c/gcc"; \ 87 \ 88 Write-Host INFO: Removing interim files; \ 89 Remove-Item *.zip; \ 90 Remove-Item go.msi; \ 91 Remove-Item gitsetup.exe; \ 92 \ 93 Write-Host INFO: Cloning and installing RSRC; \ 94 c:\git\bin\git.exe clone https://github.com/akavel/rsrc.git c:\go\src\github.com\akavel\rsrc; \ 95 cd \go\src\github.com\akavel\rsrc; c:\git\bin\git.exe checkout -q %RSRC_COMMIT%; c:\go\bin\go.exe install -v; \ 96 \ 97 Write-Host INFO: Completed 98 99 # Prepare for building 100 COPY . /go/src/github.com/docker/docker 101