Skip to content

Commit f2d1bcd

Browse files
committed
static-linux: verify that binaries are static
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 3ed868d commit f2d1bcd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

static/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CLI_DIR=$(realpath $(CURDIR)/../src/github.com/docker/cli)
44
ENGINE_DIR=$(realpath $(CURDIR)/../src/github.com/docker/docker)
55
GEN_STATIC_VER=$(shell ./gen-static-ver $(CLI_DIR) $(VERSION))
66
HASH_CMD=docker run -v $(CURDIR):/sum -w /sum debian:jessie bash hash_files
7+
LDD_RUN=ldd >/dev/null 2>/dev/null
78
DIR_TO_HASH:=build/linux
89
GO_VERSION=$(shell grep "ARG GO_VERSION" $(CLI_DIR)/dockerfiles/Dockerfile.dev | awk -F'=' '{print $$2}')
910
DOCKER_CLI_GOLANG_IMG=golang:$(GO_VERSION)
@@ -25,6 +26,7 @@ static-linux: static-cli static-engine ## create tgz with linux x86_64 client an
2526
mkdir -p build/linux/docker
2627
cp $(CLI_DIR)/build/docker build/linux/docker/
2728
for f in dockerd containerd ctr containerd-shim containerd-shim-runc-v2 docker-init docker-proxy runc; do \
29+
if $(LDD_RUN) $(ENGINE_DIR)/bundles/binary-daemon/$$f; then echo "$$f is not static, exiting..."; exit 1; fi; \
2830
cp -L $(ENGINE_DIR)/bundles/binary-daemon/$$f build/linux/docker/$$f; \
2931
done
3032
tar -C build/linux -c -z -f build/linux/docker-$(GEN_STATIC_VER).tgz docker
@@ -33,6 +35,7 @@ static-linux: static-cli static-engine ## create tgz with linux x86_64 client an
3335
mkdir -p build/linux/docker-rootless-extras
3436
for f in rootlesskit rootlesskit-docker-proxy dockerd-rootless.sh dockerd-rootless-setuptool.sh vpnkit; do \
3537
if [ -f $(ENGINE_DIR)/bundles/binary-daemon/$$f ]; then \
38+
if $(LDD_RUN) $(ENGINE_DIR)/bundles/binary-daemon/$$f; then echo "$$f is not static, exiting..."; exit 1; fi; \
3639
cp -L $(ENGINE_DIR)/bundles/binary-daemon/$$f build/linux/docker-rootless-extras/$$f; \
3740
fi \
3841
done

0 commit comments

Comments
 (0)