mirror of https://github.com/docker/docs.git
Merge pull request #22275 from Microsoft/jstarks/no_rsrc
Windows: Add file version information
This commit is contained in:
commit
78895c92c2
10
Dockerfile
10
Dockerfile
|
@ -46,6 +46,7 @@ RUN apt-get update && apt-get install -y \
|
||||||
aufs-tools \
|
aufs-tools \
|
||||||
automake \
|
automake \
|
||||||
bash-completion \
|
bash-completion \
|
||||||
|
binutils-mingw-w64 \
|
||||||
bsdmainutils \
|
bsdmainutils \
|
||||||
btrfs-tools \
|
btrfs-tools \
|
||||||
build-essential \
|
build-essential \
|
||||||
|
@ -248,15 +249,6 @@ RUN set -x \
|
||||||
&& go build -v -o /usr/local/bin/tomlv github.com/BurntSushi/toml/cmd/tomlv \
|
&& go build -v -o /usr/local/bin/tomlv github.com/BurntSushi/toml/cmd/tomlv \
|
||||||
&& rm -rf "$GOPATH"
|
&& rm -rf "$GOPATH"
|
||||||
|
|
||||||
# Build/install the tool for embedding resources in Windows binaries
|
|
||||||
ENV RSRC_COMMIT ba14da1f827188454a4591717fff29999010887f
|
|
||||||
RUN set -x \
|
|
||||||
&& export GOPATH="$(mktemp -d)" \
|
|
||||||
&& git clone https://github.com/akavel/rsrc.git "$GOPATH/src/github.com/akavel/rsrc" \
|
|
||||||
&& (cd "$GOPATH/src/github.com/akavel/rsrc" && git checkout -q "$RSRC_COMMIT") \
|
|
||||||
&& go build -v -o /usr/local/bin/rsrc github.com/akavel/rsrc \
|
|
||||||
&& rm -rf "$GOPATH"
|
|
||||||
|
|
||||||
# Install runc
|
# Install runc
|
||||||
ENV RUNC_COMMIT baf6536d6259209c3edfa2b22237af82942d3dfa
|
ENV RUNC_COMMIT baf6536d6259209c3edfa2b22237af82942d3dfa
|
||||||
RUN set -x \
|
RUN set -x \
|
||||||
|
|
|
@ -191,14 +191,6 @@ RUN set -x \
|
||||||
&& go build -v -o /usr/local/bin/tomlv github.com/BurntSushi/toml/cmd/tomlv \
|
&& go build -v -o /usr/local/bin/tomlv github.com/BurntSushi/toml/cmd/tomlv \
|
||||||
&& rm -rf "$GOPATH"
|
&& rm -rf "$GOPATH"
|
||||||
|
|
||||||
# Build/install the tool for embedding resources in Windows binaries
|
|
||||||
ENV RSRC_VERSION v2
|
|
||||||
RUN set -x \
|
|
||||||
&& export GOPATH="$(mktemp -d)" \
|
|
||||||
&& git clone --depth 1 -b "$RSRC_VERSION" https://github.com/akavel/rsrc.git "$GOPATH/src/github.com/akavel/rsrc" \
|
|
||||||
&& go build -v -o /usr/local/bin/rsrc github.com/akavel/rsrc \
|
|
||||||
&& rm -rf "$GOPATH"
|
|
||||||
|
|
||||||
# Install runc
|
# Install runc
|
||||||
ENV RUNC_COMMIT baf6536d6259209c3edfa2b22237af82942d3dfa
|
ENV RUNC_COMMIT baf6536d6259209c3edfa2b22237af82942d3dfa
|
||||||
RUN set -x \
|
RUN set -x \
|
||||||
|
|
|
@ -187,14 +187,6 @@ RUN set -x \
|
||||||
&& go build -v -o /usr/local/bin/tomlv github.com/BurntSushi/toml/cmd/tomlv \
|
&& go build -v -o /usr/local/bin/tomlv github.com/BurntSushi/toml/cmd/tomlv \
|
||||||
&& rm -rf "$GOPATH"
|
&& rm -rf "$GOPATH"
|
||||||
|
|
||||||
# Build/install the tool for embedding resources in Windows binaries
|
|
||||||
ENV RSRC_VERSION v2
|
|
||||||
RUN set -x \
|
|
||||||
&& export GOPATH="$(mktemp -d)" \
|
|
||||||
&& git clone --depth 1 -b "$RSRC_VERSION" https://github.com/akavel/rsrc.git "$GOPATH/src/github.com/akavel/rsrc" \
|
|
||||||
&& go build -v -o /usr/local/bin/rsrc github.com/akavel/rsrc \
|
|
||||||
&& rm -rf "$GOPATH"
|
|
||||||
|
|
||||||
# Install runc
|
# Install runc
|
||||||
ENV RUNC_COMMIT baf6536d6259209c3edfa2b22237af82942d3dfa
|
ENV RUNC_COMMIT baf6536d6259209c3edfa2b22237af82942d3dfa
|
||||||
RUN set -x \
|
RUN set -x \
|
||||||
|
|
|
@ -169,14 +169,6 @@ RUN set -x \
|
||||||
&& go build -v -o /usr/local/bin/tomlv github.com/BurntSushi/toml/cmd/tomlv \
|
&& go build -v -o /usr/local/bin/tomlv github.com/BurntSushi/toml/cmd/tomlv \
|
||||||
&& rm -rf "$GOPATH"
|
&& rm -rf "$GOPATH"
|
||||||
|
|
||||||
# Build/install the tool for embedding resources in Windows binaries
|
|
||||||
ENV RSRC_VERSION v2
|
|
||||||
RUN set -x \
|
|
||||||
&& export GOPATH="$(mktemp -d)" \
|
|
||||||
&& git clone --depth 1 -b "$RSRC_VERSION" https://github.com/akavel/rsrc.git "$GOPATH/src/github.com/akavel/rsrc" \
|
|
||||||
&& go build -v -o /usr/local/bin/rsrc github.com/akavel/rsrc \
|
|
||||||
&& rm -rf "$GOPATH"
|
|
||||||
|
|
||||||
# Install runc
|
# Install runc
|
||||||
ENV RUNC_COMMIT baf6536d6259209c3edfa2b22237af82942d3dfa
|
ENV RUNC_COMMIT baf6536d6259209c3edfa2b22237af82942d3dfa
|
||||||
RUN set -x \
|
RUN set -x \
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
# This file describes the standard way to build Docker, using a docker container on Windows
|
# This file describes the standard way to build Docker, using a docker container on Windows
|
||||||
# Server 2016
|
# Server 2016
|
||||||
#
|
#
|
||||||
# Usage:
|
# Usage:
|
||||||
#
|
#
|
||||||
# # Assemble the full dev environment. This is slow the first time. Run this from
|
# # 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
|
# # a directory containing the sources you are validating. For example from
|
||||||
# # c:\go\src\github.com\docker\docker
|
# # c:\go\src\github.com\docker\docker
|
||||||
#
|
#
|
||||||
# docker build -t docker -f Dockerfile.windows .
|
# docker build -t docker -f Dockerfile.windows .
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
#
|
#
|
||||||
# The posix utilities from GIT aren't usable interactively as at January 2016. This
|
# The 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.
|
# 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!!!
|
# 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 posix utilities will
|
# Don't try to use a volume for passing the source through. The posix utilities will
|
||||||
# balk at reparse points. Again, see the example at the top of this file on how use a volume
|
# balk at reparse points. Again, see the example at the top of this file on how use a volume
|
||||||
|
@ -36,7 +36,6 @@ FROM windowsservercore
|
||||||
# - FROM_DOCKERFILE is used for detection of building within a container.
|
# - FROM_DOCKERFILE is used for detection of building within a container.
|
||||||
ENV GO_VERSION=1.5.3 \
|
ENV GO_VERSION=1.5.3 \
|
||||||
GIT_LOCATION=https://github.com/git-for-windows/git/releases/download/v2.7.2.windows.1/Git-2.7.2-64-bit.exe \
|
GIT_LOCATION=https://github.com/git-for-windows/git/releases/download/v2.7.2.windows.1/Git-2.7.2-64-bit.exe \
|
||||||
RSRC_COMMIT=ba14da1f827188454a4591717fff29999010887f \
|
|
||||||
GOPATH=C:/go;C:/go/src/github.com/docker/docker/vendor \
|
GOPATH=C:/go;C:/go/src/github.com/docker/docker/vendor \
|
||||||
FROM_DOCKERFILE=1
|
FROM_DOCKERFILE=1
|
||||||
|
|
||||||
|
@ -52,7 +51,7 @@ RUN \
|
||||||
$wc = New-Object net.webclient; $wc.Downloadfile($source, $target) \
|
$wc = New-Object net.webclient; $wc.Downloadfile($source, $target) \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
Write-Host INFO: Downloading git...; \
|
Write-Host INFO: Downloading git...; \
|
||||||
Download-File %GIT_LOCATION% gitsetup.exe; \
|
Download-File %GIT_LOCATION% gitsetup.exe; \
|
||||||
\
|
\
|
||||||
Write-Host INFO: Downloading go...; \
|
Write-Host INFO: Downloading go...; \
|
||||||
|
@ -83,12 +82,8 @@ RUN \
|
||||||
Remove-Item go.msi; \
|
Remove-Item go.msi; \
|
||||||
Remove-Item gitsetup.exe; \
|
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
|
Write-Host INFO: Completed
|
||||||
|
|
||||||
# Prepare for building
|
# Prepare for building
|
||||||
COPY . /go/src/github.com/docker/docker
|
COPY . /go/src/github.com/docker/docker
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "github.com/docker/docker/autogen/winresources"
|
_ "github.com/docker/docker/autogen/winresources/docker"
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "github.com/docker/docker/autogen/winresources"
|
_ "github.com/docker/docker/autogen/winresources/dockerd"
|
||||||
)
|
)
|
||||||
|
|
|
@ -20,44 +20,40 @@ const (
|
||||||
DVEOF
|
DVEOF
|
||||||
|
|
||||||
# Compile the Windows resources into the sources
|
# Compile the Windows resources into the sources
|
||||||
mkdir -p autogen/winresources
|
if [ "$(go env GOOS)" = "windows" ]; then
|
||||||
cat > autogen/winresources/resources.go <<WREOF
|
mkdir -p autogen/winresources/tmp autogen/winresources/docker autogen/winresources/dockerd
|
||||||
// Package winresources is auto-generated at build-time
|
cp hack/make/.resources-windows/resources.go autogen/winresources/docker/
|
||||||
// AUTOGENERATED FILE; see $BASH_SOURCE
|
cp hack/make/.resources-windows/resources.go autogen/winresources/dockerd/
|
||||||
package winresources
|
|
||||||
|
|
||||||
/*
|
if [ "$(go env GOHOSTOS)" == "windows" ]; then
|
||||||
|
WINDRES=windres
|
||||||
|
else
|
||||||
|
# Cross compiling
|
||||||
|
WINDRES=x86_64-w64-mingw32-windres
|
||||||
|
fi
|
||||||
|
|
||||||
This package is for embedding a manifest file and an icon into docker.exe.
|
# Generate a Windows file version of the form major,minor,patch,build (with any part optional)
|
||||||
The benefit of this is that a manifest file does not need to be alongside
|
VERSION_QUAD=$(echo -n $VERSION | sed -re 's/^([0-9.]*).*$/\1/' | tr . ,)
|
||||||
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:
|
# Pass version and commit information into the resource compiler
|
||||||
|
defs=
|
||||||
|
[ ! -z $VERSION ] && defs="$defs -D DOCKER_VERSION=\"$VERSION\""
|
||||||
|
[ ! -z $VERSION_QUAD ] && defs="$defs -D DOCKER_VERSION_QUAD=$VERSION_QUAD"
|
||||||
|
[ ! -z $GITCOMMIT ] && defs="$defs -D DOCKER_COMMIT=\"$GITCOMMIT\""
|
||||||
|
|
||||||
- Cloning github.com/akavel/rsrc
|
function makeres {
|
||||||
|
$WINDRES \
|
||||||
|
-i hack/make/.resources-windows/$1 \
|
||||||
|
-o $3 \
|
||||||
|
-F $2 \
|
||||||
|
--use-temp-file \
|
||||||
|
-I autogen/winresources/tmp \
|
||||||
|
$defs
|
||||||
|
}
|
||||||
|
|
||||||
- Go-installing the rsrc executable
|
makeres docker.rc pe-x86-64 autogen/winresources/docker/rsrc_amd64.syso
|
||||||
|
makeres docker.rc pe-i386 autogen/winresources/docker/rsrc_386.syso
|
||||||
|
makeres dockerd.rc pe-x86-64 autogen/winresources/dockerd/rsrc_amd64.syso
|
||||||
|
|
||||||
make.sh invokes hack/make/.go-autogen to:
|
rm -r autogen/winresources/tmp
|
||||||
|
|
||||||
- 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 \
|
|
||||||
-arch "amd64" \
|
|
||||||
-o autogen/winresources/rsrc_amd64.syso > /dev/null
|
|
||||||
|
|
||||||
rsrc \
|
|
||||||
-manifest hack/make/.resources-windows/docker.exe.manifest \
|
|
||||||
-ico hack/make/.resources-windows/docker.ico \
|
|
||||||
-arch "386" \
|
|
||||||
-o autogen/winresources/rsrc_386.syso > /dev/null
|
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
// Application icon
|
||||||
|
1 ICON "docker.ico"
|
||||||
|
|
||||||
|
// Windows executable manifest
|
||||||
|
1 24 /* RT_MANIFEST */ "docker.exe.manifest"
|
||||||
|
|
||||||
|
// Version information
|
||||||
|
1 VERSIONINFO
|
||||||
|
|
||||||
|
#ifdef DOCKER_VERSION_QUAD
|
||||||
|
FILEVERSION DOCKER_VERSION_QUAD
|
||||||
|
PRODUCTVERSION DOCKER_VERSION_QUAD
|
||||||
|
#endif
|
||||||
|
|
||||||
|
BEGIN
|
||||||
|
BLOCK "StringFileInfo"
|
||||||
|
BEGIN
|
||||||
|
BLOCK "000004B0"
|
||||||
|
BEGIN
|
||||||
|
VALUE "ProductName", DOCKER_NAME
|
||||||
|
|
||||||
|
#ifdef DOCKER_VERSION
|
||||||
|
VALUE "FileVersion", DOCKER_VERSION
|
||||||
|
VALUE "ProductVersion", DOCKER_VERSION
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef DOCKER_COMMIT
|
||||||
|
VALUE "OriginalFileName", DOCKER_COMMIT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
END
|
||||||
|
END
|
||||||
|
|
||||||
|
BLOCK "VarFileInfo"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Translation", 0x0000, 0x04B0
|
||||||
|
END
|
||||||
|
END
|
|
@ -0,0 +1,3 @@
|
||||||
|
#define DOCKER_NAME "Docker Client"
|
||||||
|
|
||||||
|
#include "common.rc"
|
|
@ -0,0 +1,3 @@
|
||||||
|
#define DOCKER_NAME "Docker Engine"
|
||||||
|
|
||||||
|
#include "common.rc"
|
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
|
||||||
|
Package winresources is used to embed Windows resources into docker.exe.
|
||||||
|
These resources are used to provide
|
||||||
|
|
||||||
|
* Version information
|
||||||
|
* An icon
|
||||||
|
* A Windows manifest declaring Windows version support
|
||||||
|
|
||||||
|
The resource object files are generated in hack/make/.go-autogen from
|
||||||
|
source files in hack/make/.resources-windows. This occurs automatically
|
||||||
|
when you run hack/make.sh.
|
||||||
|
|
||||||
|
These object files are picked up automatically by go build when this package
|
||||||
|
is included.
|
||||||
|
|
||||||
|
*/
|
||||||
|
package winresources
|
Loading…
Reference in New Issue