Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit 23a9017

Browse files
authored
Merge pull request #455 from thaJeztah/18.03-fix_static_builds
[18.03] fix static builds
2 parents cbc5bef + fb4173d commit 23a9017

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

components/engine/hack/dockerfile/install/containerd.installer

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,15 @@ install_containerd() {
1414

1515
(
1616

17-
if [ "$1" == "static" ]; then
18-
export BUILDTAGS='static_build netgo'
19-
export EXTRA_FLAGS='-buildmod pie'
20-
export EXTRA_LDFLAGS='-extldflags "-fno-PIC -static"'
17+
export BUILDTAGS='static_build netgo'
18+
export EXTRA_FLAGS='-buildmode=pie'
19+
export EXTRA_LDFLAGS='-extldflags "-fno-PIC -static"'
20+
21+
# Reset build flags to nothing if we want a dynbinary
22+
if [ "$1" == "dynamic" ]; then
23+
export BUILDTAGS=''
24+
export EXTRA_FLAGS=''
25+
export EXTRA_LDFLAGS=''
2126
fi
2227

2328
make

components/engine/hack/dockerfile/install/proxy.installer

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ install_proxy() {
2323

2424
install_proxy_dynamic() {
2525
export PROXY_LDFLAGS="-linkmode=external" install_proxy
26+
export BUILD_MODE="-buildmode=pie"
2627
_install_proxy
2728
}
2829

@@ -31,7 +32,7 @@ _install_proxy() {
3132
git clone https://github.com/docker/libnetwork.git "$GOPATH/src/github.com/docker/libnetwork"
3233
cd "$GOPATH/src/github.com/docker/libnetwork"
3334
git checkout -q "$LIBNETWORK_COMMIT"
34-
go build -buildmode=pie -ldflags="$PROXY_LDFLAGS" -o ${PREFIX}/docker-proxy github.com/docker/libnetwork/cmd/proxy
35+
go build $BUILD_MODE -ldflags="$PROXY_LDFLAGS" -o ${PREFIX}/docker-proxy github.com/docker/libnetwork/cmd/proxy
3536
}
3637

3738

components/engine/hack/dockerfile/install/runc.installer

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ install_runc() {
1111
git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc"
1212
cd "$GOPATH/src/github.com/opencontainers/runc"
1313
git checkout -q "$RUNC_COMMIT"
14-
make BUILDTAGS="$RUNC_BUILDTAGS" $1
14+
if [ -z "$1" ]; then
15+
target=static
16+
else
17+
target="$1"
18+
fi
19+
make BUILDTAGS="$RUNC_BUILDTAGS" "$target"
1520
mkdir -p ${PREFIX}
1621
cp runc ${PREFIX}/docker-runc
1722
}

0 commit comments

Comments
 (0)