2016-01-20 21:51:34 -05:00
|
|
|
# This file describes the standard way to build Docker, using a docker container on Windows
|
|
|
|
# Server 2016
|
2015-12-01 03:47:19 -05:00
|
|
|
#
|
|
|
|
# Usage:
|
|
|
|
#
|
2016-01-20 21:51:34 -05:00
|
|
|
# # Assemble the full dev environment. This is slow the first time. Run this from
|
|
|
|
# # a directory containing the sources you are validating. For example from
|
|
|
|
# # c:\go\src\github.com\docker\docker
|
|
|
|
#
|
2015-12-01 03:47:19 -05:00
|
|
|
# docker build -t docker -f Dockerfile.windows .
|
|
|
|
#
|
|
|
|
#
|
2016-01-20 21:51:34 -05:00
|
|
|
# # Build docker in a container. Run the following from a Windows cmd command prommpt,
|
|
|
|
# # replacing c:\built with the directory you want the binaries to be placed on the
|
|
|
|
# # host system.
|
|
|
|
#
|
|
|
|
# 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'
|
|
|
|
#
|
|
|
|
# Important notes:
|
|
|
|
# ---------------
|
|
|
|
#
|
2016-01-30 23:50:11 -05:00
|
|
|
# 'Start-Sleep' is a deliberate workaround for a current problem on containers in Windows
|
2016-01-20 21:51:34 -05:00
|
|
|
# Server 2016. It ensures that the network is up and available for when the command is
|
|
|
|
# network related. This bug is being tracked internally at Microsoft and exists in TP4.
|
|
|
|
# Generally sleep 1 or 2 is probably enough, but making it 5 to make the build file
|
|
|
|
# as bullet proof as possible. This isn't a big deal as this only runs the first time.
|
|
|
|
#
|
|
|
|
# The cygwin posix utilities from GIT aren't usable interactively as at January 2016. This
|
|
|
|
# is because they require a console window which isn't present in a container in Windows.
|
|
|
|
# See the example at the top of this file. Do NOT use -it in that docker run!!!
|
|
|
|
#
|
|
|
|
# Don't try to use a volume for passing the source through. The cygwin posix utilities will
|
|
|
|
# balk at reparse points. Again, see the example at the top of this file on how use a volume
|
|
|
|
# to get the built binary out of the container.
|
2016-01-30 23:50:11 -05:00
|
|
|
#
|
|
|
|
# The steps are minimised dramatically to improve performance (TP4 is slow on commit)
|
2015-12-01 03:47:19 -05:00
|
|
|
|
|
|
|
FROM windowsservercore
|
|
|
|
|
2016-01-20 21:51:34 -05:00
|
|
|
# Environment variable notes:
|
2016-03-24 18:41:34 -04:00
|
|
|
# - GO_VERSION must consistent with 'Dockerfile' used by Linux'.
|
2016-01-20 21:51:34 -05:00
|
|
|
# - FROM_DOCKERFILE is used for detection of building within a container.
|
2016-03-24 18:41:34 -04:00
|
|
|
ENV GO_VERSION=1.5.3 \
|
2016-03-01 12:05:12 -05:00
|
|
|
GIT_LOCATION=https://github.com/git-for-windows/git/releases/download/v2.7.2.windows.1/Git-2.7.2-64-bit.exe \
|
2016-01-20 21:51:34 -05:00
|
|
|
RSRC_COMMIT=ba14da1f827188454a4591717fff29999010887f \
|
2015-12-01 03:47:19 -05:00
|
|
|
GOPATH=C:/go;C:/go/src/github.com/docker/docker/vendor \
|
|
|
|
FROM_DOCKERFILE=1
|
|
|
|
|
2016-01-30 23:50:11 -05:00
|
|
|
WORKDIR c:/
|
2015-12-01 03:47:19 -05:00
|
|
|
|
2016-01-30 23:50:11 -05:00
|
|
|
# Everything downloaded/installed in one go (better performance, esp on TP4)
|
|
|
|
RUN \
|
|
|
|
setx /M Path "c:\git\cmd;c:\git\bin;c:\git\usr\bin;%Path%;c:\gcc\bin;c:\go\bin" && \
|
|
|
|
setx GOROOT "c:\go" && \
|
|
|
|
powershell -command \
|
|
|
|
$ErrorActionPreference = 'Stop'; \
|
|
|
|
Start-Sleep -Seconds 5; \
|
|
|
|
Function Download-File([string] $source, [string] $target) { \
|
|
|
|
$wc = New-Object net.webclient; $wc.Downloadfile($source, $target) \
|
|
|
|
} \
|
|
|
|
\
|
|
|
|
Write-Host INFO: Downloading git...; \
|
|
|
|
Download-File %GIT_LOCATION% gitsetup.exe; \
|
|
|
|
\
|
|
|
|
Write-Host INFO: Downloading go...; \
|
2016-03-24 18:41:34 -04:00
|
|
|
Download-File https://storage.googleapis.com/golang/go%GO_VERSION%.windows-amd64.msi go.msi; \
|
2016-01-30 23:50:11 -05:00
|
|
|
\
|
|
|
|
Write-Host INFO: Downloading compiler 1 of 3...; \
|
|
|
|
Download-File https://raw.githubusercontent.com/jhowardmsft/docker-tdmgcc/master/gcc.zip gcc.zip; \
|
|
|
|
\
|
|
|
|
Write-Host INFO: Downloading compiler 2 of 3...; \
|
|
|
|
Download-File https://raw.githubusercontent.com/jhowardmsft/docker-tdmgcc/master/runtime.zip runtime.zip; \
|
|
|
|
\
|
|
|
|
Write-Host INFO: Downloading compiler 3 of 3...; \
|
|
|
|
Download-File https://raw.githubusercontent.com/jhowardmsft/docker-tdmgcc/master/binutils.zip binutils.zip; \
|
|
|
|
\
|
|
|
|
Write-Host INFO: Installing git...; \
|
|
|
|
Start-Process gitsetup.exe -ArgumentList '/VERYSILENT /SUPPRESSMSGBOXES /CLOSEAPPLICATIONS /DIR=c:\git\' -Wait; \
|
|
|
|
\
|
|
|
|
Write-Host INFO: Installing go..."; \
|
|
|
|
Start-Process msiexec -ArgumentList '-i go.msi -quiet' -Wait; \
|
|
|
|
\
|
|
|
|
Write-Host INFO: Unzipping compiler...; \
|
|
|
|
c:\git\usr\bin\unzip.exe -q -o gcc.zip -d /c/gcc; \
|
|
|
|
c:\git\usr\bin\unzip.exe -q -o runtime.zip -d /c/gcc; \
|
|
|
|
c:\git\usr\bin\unzip.exe -q -o binutils.zip -d /c/gcc"; \
|
|
|
|
\
|
|
|
|
Write-Host INFO: Removing interim files; \
|
|
|
|
Remove-Item *.zip; \
|
|
|
|
Remove-Item go.msi; \
|
|
|
|
Remove-Item gitsetup.exe; \
|
|
|
|
\
|
|
|
|
Write-Host INFO: Cloning and installing RSRC; \
|
|
|
|
c:\git\bin\git.exe clone https://github.com/akavel/rsrc.git c:\go\src\github.com\akavel\rsrc; \
|
|
|
|
cd \go\src\github.com\akavel\rsrc; c:\git\bin\git.exe checkout -q %RSRC_COMMIT%; c:\go\bin\go.exe install -v; \
|
|
|
|
\
|
|
|
|
Write-Host INFO: Completed
|
|
|
|
|
2016-01-20 21:51:34 -05:00
|
|
|
# Prepare for building
|
2015-12-01 03:47:19 -05:00
|
|
|
COPY . /go/src/github.com/docker/docker
|
2016-01-20 21:51:34 -05:00
|
|
|
|