Skip to content

Commit a4c2ca2

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

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
@@ -5,6 +5,7 @@ ENGINE_DIR:=$(realpath $(CURDIR)/../../engine)
55
STATIC_VERSION:=$(shell ./gen-static-ver $(ENGINE_DIR) $(VERSION))
66
CHOWN=docker run --rm -v $(CURDIR):/v -w /v alpine chown
77
HASH_CMD=docker run -v $(CURDIR):/sum -w /sum debian:jessie bash hash_files
8+
LDD_RUN=ldd >/dev/null 2>/dev/null
89
DIR_TO_HASH:=build/linux
910
GO_VERSION=$(shell grep "ARG GO_VERSION" $(CLI_DIR)/dockerfiles/Dockerfile.dev | awk -F'=' '{print $$2}')
1011
DOCKER_CLI_GOLANG_IMG=golang:$(GO_VERSION)
@@ -26,6 +27,7 @@ static-linux: static-cli static-engine ## create tgz with linux x86_64 client an
2627
mkdir -p build/linux/docker
2728
cp $(CLI_DIR)/build/docker build/linux/docker/
2829
for f in dockerd containerd ctr containerd-shim docker-init docker-proxy runc; do \
30+
if $(LDD_RUN) $(ENGINE_DIR)/bundles/binary-daemon/$$f; then echo "$$f is not static, exiting..."; exit 1; fi; \
2931
cp -L $(ENGINE_DIR)/bundles/binary-daemon/$$f build/linux/docker/$$f; \
3032
done
3133
tar -C build/linux -c -z -f build/linux/docker-$(STATIC_VERSION).tgz docker
@@ -34,6 +36,7 @@ static-linux: static-cli static-engine ## create tgz with linux x86_64 client an
3436
mkdir -p build/linux/docker-rootless-extras
3537
for f in rootlesskit rootlesskit-docker-proxy dockerd-rootless.sh vpnkit; do \
3638
if [ -f $(ENGINE_DIR)/bundles/binary-daemon/$$f ]; then \
39+
if $(LDD_RUN) $(ENGINE_DIR)/bundles/binary-daemon/$$f; then echo "$$f is not static, exiting..."; exit 1; fi; \
3740
cp -L $(ENGINE_DIR)/bundles/binary-daemon/$$f build/linux/docker-rootless-extras/$$f; \
3841
fi \
3942
done

0 commit comments

Comments
 (0)