mirror of https://github.com/docker/docs.git
Merge pull request #7 from tianon/fix-hack-tags
Update build tags such that we can properly compile on all platforms
This commit is contained in:
commit
2128eb52ed
|
@ -87,6 +87,7 @@ RUN git config --global user.email 'docker-dummy@example.com'
|
||||||
|
|
||||||
VOLUME /var/lib/docker
|
VOLUME /var/lib/docker
|
||||||
WORKDIR /go/src/github.com/dotcloud/docker
|
WORKDIR /go/src/github.com/dotcloud/docker
|
||||||
|
ENV DOCKER_BUILDTAGS apparmor
|
||||||
|
|
||||||
# Wrap all commands in the "docker-in-docker" script to allow nested containers
|
# Wrap all commands in the "docker-in-docker" script to allow nested containers
|
||||||
ENTRYPOINT ["hack/dind"]
|
ENTRYPOINT ["hack/dind"]
|
||||||
|
|
|
@ -148,6 +148,15 @@ This will cause the build scripts to set up a reasonable `GOPATH` that
|
||||||
automatically and properly includes both dotcloud/docker from the local
|
automatically and properly includes both dotcloud/docker from the local
|
||||||
directory, and the local "./vendor" directory as necessary.
|
directory, and the local "./vendor" directory as necessary.
|
||||||
|
|
||||||
|
### `DOCKER_BUILDTAGS`
|
||||||
|
|
||||||
|
If you're building a binary that may need to be used on platforms that include
|
||||||
|
AppArmor, you will need to set `DOCKER_BUILDTAGS` as follows:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export DOCKER_BUILDTAGS='apparmor'
|
||||||
|
```
|
||||||
|
|
||||||
### Static Daemon
|
### Static Daemon
|
||||||
|
|
||||||
If it is feasible within the constraints of your distribution, you should
|
If it is feasible within the constraints of your distribution, you should
|
||||||
|
|
|
@ -84,8 +84,7 @@ fi
|
||||||
# Use these flags when compiling the tests and final binary
|
# Use these flags when compiling the tests and final binary
|
||||||
LDFLAGS='-X github.com/dotcloud/docker/dockerversion.GITCOMMIT "'$GITCOMMIT'" -X github.com/dotcloud/docker/dockerversion.VERSION "'$VERSION'" -w'
|
LDFLAGS='-X github.com/dotcloud/docker/dockerversion.GITCOMMIT "'$GITCOMMIT'" -X github.com/dotcloud/docker/dockerversion.VERSION "'$VERSION'" -w'
|
||||||
LDFLAGS_STATIC='-X github.com/dotcloud/docker/dockerversion.IAMSTATIC true -linkmode external -extldflags "-lpthread -static -Wl,--unresolved-symbols=ignore-in-object-files"'
|
LDFLAGS_STATIC='-X github.com/dotcloud/docker/dockerversion.IAMSTATIC true -linkmode external -extldflags "-lpthread -static -Wl,--unresolved-symbols=ignore-in-object-files"'
|
||||||
BUILDFLAGS='-a'
|
BUILDFLAGS=( -a -tags "netgo $DOCKER_BUILDTAGS" )
|
||||||
BUILDTAGS="apparmor netgo"
|
|
||||||
|
|
||||||
HAVE_GO_TEST_COVER=
|
HAVE_GO_TEST_COVER=
|
||||||
if \
|
if \
|
||||||
|
@ -114,7 +113,7 @@ go_test_dir() {
|
||||||
(
|
(
|
||||||
set -x
|
set -x
|
||||||
cd "$dir"
|
cd "$dir"
|
||||||
go test ${testcover[@]} -ldflags "$LDFLAGS" $BUILDFLAGS $TESTFLAGS
|
go test ${testcover[@]} -ldflags "$LDFLAGS" "${BUILDFLAGS[@]}" $TESTFLAGS
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
DEST=$1
|
DEST=$1
|
||||||
|
|
||||||
go build -o $DEST/docker-$VERSION -ldflags "$LDFLAGS $LDFLAGS_STATIC" $BUILDFLAGS -tags "$BUILDTAGS" ./docker
|
go build -o $DEST/docker-$VERSION -ldflags "$LDFLAGS $LDFLAGS_STATIC" "${BUILDFLAGS[@]}" ./docker
|
||||||
echo "Created binary: $DEST/docker-$VERSION"
|
echo "Created binary: $DEST/docker-$VERSION"
|
||||||
|
|
|
@ -18,7 +18,6 @@ for platform in $DOCKER_CROSSPLATFORMS; do
|
||||||
export GOOS=${platform%/*}
|
export GOOS=${platform%/*}
|
||||||
export GOARCH=${platform##*/}
|
export GOARCH=${platform##*/}
|
||||||
export LDFLAGS_STATIC="" # we just need a simple client for these platforms (TODO this might change someday)
|
export LDFLAGS_STATIC="" # we just need a simple client for these platforms (TODO this might change someday)
|
||||||
export BUILDTAGS="netgo"
|
|
||||||
source "$(dirname "$BASH_SOURCE")/binary" "$DEST/$platform"
|
source "$(dirname "$BASH_SOURCE")/binary" "$DEST/$platform"
|
||||||
)
|
)
|
||||||
done
|
done
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
DEST=$1
|
DEST=$1
|
||||||
|
|
||||||
# dockerinit still needs to be a static binary, even if docker is dynamic
|
# dockerinit still needs to be a static binary, even if docker is dynamic
|
||||||
CGO_ENABLED=0 go build -o $DEST/dockerinit-$VERSION -ldflags "$LDFLAGS -d" $BUILDFLAGS ./dockerinit
|
CGO_ENABLED=0 go build -o $DEST/dockerinit-$VERSION -ldflags "$LDFLAGS -d" "${BUILDFLAGS[@]}" ./dockerinit
|
||||||
echo "Created binary: $DEST/dockerinit-$VERSION"
|
echo "Created binary: $DEST/dockerinit-$VERSION"
|
||||||
ln -sf dockerinit-$VERSION $DEST/dockerinit
|
ln -sf dockerinit-$VERSION $DEST/dockerinit
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// +build apparmor
|
// +build apparmor,linux,amd64
|
||||||
|
|
||||||
package apparmor
|
package apparmor
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// +build !apparmor
|
// +build !apparmor !linux !amd64
|
||||||
|
|
||||||
package apparmor
|
package apparmor
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue