Windows: Build docker.exe manifested and with icon

Signed-off-by: John Howard <John.Howard@microsoft.com>
This commit is contained in:
John Howard 2015-05-06 08:41:17 -07:00
parent a242ceaa09
commit fd935ee63d
6 changed files with 68 additions and 2 deletions

View File

@ -176,6 +176,14 @@ COPY vendor /go/src/github.com/docker/docker/vendor
RUN go install -v github.com/cpuguy83/go-md2man \
github.com/BurntSushi/toml/cmd/tomlv
# Build/install the tool for embedding resources in Windows binaries
ENV RSRC_COMMIT e48dbf1b7fc464a9e85fcec450dddf80816b76e0
RUN set -x \
&& git clone https://github.com/akavel/rsrc.git /go/src/github.com/akavel/rsrc \
&& cd /go/src/github.com/akavel/rsrc \
&& git checkout -q $RSRC_COMMIT \
&& go install -v
# Wrap all commands in the "docker-in-docker" script to allow nested containers
ENTRYPOINT ["hack/dind"]

5
docker/docker_windows.go Normal file
View File

@ -0,0 +1,5 @@
package main
import (
_ "github.com/docker/docker/autogen/winresources"
)

View File

@ -3,7 +3,7 @@
rm -rf autogen
mkdir -p autogen/dockerversion
cat > autogen/dockerversion/dockerversion.go <<EOF
cat > autogen/dockerversion/dockerversion.go <<DVEOF
// AUTOGENERATED FILE; see $BASH_SOURCE
package dockerversion
@ -15,4 +15,39 @@ var (
INITSHA1 string = "$DOCKER_INITSHA1"
INITPATH string = "$DOCKER_INITPATH"
)
EOF
DVEOF
# Compile the Windows resources into the sources
mkdir -p autogen/winresources
cat > autogen/winresources/resources.go <<WREOF
// AUTOGENERATED FILE; see $BASH_SOURCE
package winresources
/*
This package is for embedding a manifest file and an icon into docker.exe.
The benefit of this is that a manifest file does not need to be alongside
the .exe, and there is an icon when docker runs, or viewed through Windows
explorer.
When make binary is run, the Dockerfile prepares the build environment by:
- Cloning github.com/akavel/rsrc
- Go-installing the rsrc executable
make.sh invokes hack/make/.go-autogen to:
- Run rsrc to create a binary file (autogen/winresources/rsrc.syso) that
contains the manifest and icon. This file is automatically picked up by
'go build', so no post-processing steps are required. The sources for
rsrc.syso are under hack/make/.resources-windows.
*/
WREOF
if [ "$(go env GOOS)" = 'windows' ]; then
rsrc \
-manifest hack/make/.resources-windows/docker.exe.manifest \
-ico hack/make/.resources-windows/docker.ico \
-o autogen/winresources/rsrc.syso > /dev/null
fi

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<description>Docker</description>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
</application>
</compatibility>
</assembly>

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 KiB