From cea6d4e302816786db557a92b0b35ecdbb22b04a Mon Sep 17 00:00:00 2001 From: Eli Uriegas Date: Wed, 22 Aug 2018 23:11:53 +0000 Subject: [PATCH 1/4] Make GO_IMAGE configurable, default to official go Signed-off-by: Eli Uriegas (cherry picked from commit 4cdbe08bf929d5c731b61e1cea217fa40156a3a8) Signed-off-by: Eli Uriegas Upstream-commit: 5bfb6ce9464fea13abc71fb6c12b9f5cb01a29a4 Component: packaging --- components/packaging/image/Dockerfile.engine | 24 ++++++++++++++------ components/packaging/image/Makefile | 6 ++++- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/components/packaging/image/Dockerfile.engine b/components/packaging/image/Dockerfile.engine index d393faf7f1..b13edb552f 100644 --- a/components/packaging/image/Dockerfile.engine +++ b/components/packaging/image/Dockerfile.engine @@ -1,13 +1,23 @@ # Common builder -FROM golang:1.10-alpine3.7 as builder - -#COPY hack/dockerfile/binaries-commits / +ARG GO_IMAGE +FROM ${GO_IMAGE} as builder COPY hack/dockerfile/install/tini.installer / COPY hack/dockerfile/install/proxy.installer / -RUN apk --update add bash btrfs-progs-dev gcc libc-dev linux-headers \ - git cmake make ca-certificates libltdl libtool libgcc && \ - grep "_COMMIT=" /*.installer |cut -f2- -d: > /binaries-commits +RUN apt-get update && apt-get install -y \ + bash \ + btrfs-progs-dev \ + ca-certificates \ + cmake \ + gcc \ + git \ + libc-dev \ + libgcc \ + libltdl \ + libtool \ + linux-headers \ + make +RUN grep "_COMMIT=" /*.installer |cut -f2- -d: > /binaries-commits # dockerd FROM builder as dockerd-builder @@ -39,7 +49,7 @@ RUN git clone https://github.com/docker/libnetwork.git /go/src/github.com/docker WORKDIR /go/src/github.com/docker/libnetwork RUN source /binaries-commits && \ git checkout -q "$LIBNETWORK_COMMIT" && \ - go build -buildmode=pie -ldflags="$PROXY_LDFLAGS" \ + CGO_ENABLED=0 go build -buildmode=pie -ldflags="$PROXY_LDFLAGS" \ -o /sbin/docker-proxy \ github.com/docker/libnetwork/cmd/proxy diff --git a/components/packaging/image/Makefile b/components/packaging/image/Makefile index 7718ef11b6..89d4135ec1 100644 --- a/components/packaging/image/Makefile +++ b/components/packaging/image/Makefile @@ -2,6 +2,9 @@ SHELL:=/bin/bash ENGINE_DIR:=$(CURDIR)/../../engine CLI_DIR:=$(CURDIR)/../../cli VERSION?=0.0.0-dev +GO_BASE_IMAGE=golang +GO_VERSION:=1.10.3 +GO_IMAGE=$(GO_BASE_IMAGE):$(GO_VERSION) STATIC_VERSION=$(shell ../static/gen-static-ver $(ENGINE_DIR) $(VERSION)) DOCKER_HUB_ORG?=dockereng ARCH=$(shell uname -m) @@ -24,10 +27,11 @@ image: image-linux $(ENGINE_DIR)/Dockerfile.engine: cp Dockerfile.engine $(ENGINE_DIR) -# builds across multiple archs because the base images +# builds across multiple archs because the base images # utilize manifests image-linux: $(ENGINE_DIR)/Dockerfile.engine docker build -t $(DOCKER_HUB_ORG)/$(ENGINE_IMAGE):$(STATIC_VERSION).$(ARCH) \ + --build-arg GO_IMAGE="$(GO_IMAGE)" \ --build-arg VERSION="$(STATIC_VERSION)" \ --build-arg GITCOMMIT="$$(cd $(ENGINE_DIR) && git rev-parse --short=7 HEAD)" \ --build-arg BUILDTIME="$(BUILDTIME)" \ From adca33ea9c59f0a949017ec88db566ffd0fe0644 Mon Sep 17 00:00:00 2001 From: Eli Uriegas Date: Wed, 22 Aug 2018 23:24:19 +0000 Subject: [PATCH 2/4] Fix whitespace, add Dockerfile.engine to clean Signed-off-by: Eli Uriegas (cherry picked from commit 831482a3296e9a7b1ad10f6b8c850a7a4095b881) Signed-off-by: Eli Uriegas Upstream-commit: ce1d295cf4f7049dc48813d825511a85ebf7e9c1 Component: packaging --- components/packaging/image/Makefile | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/components/packaging/image/Makefile b/components/packaging/image/Makefile index 89d4135ec1..9435288ad5 100644 --- a/components/packaging/image/Makefile +++ b/components/packaging/image/Makefile @@ -17,6 +17,7 @@ help: ## show make targets .PHONY: clean clean: ## remove build artifacts + -$(RM) $(ENGINE_DIR)/Dockerfile.engine -docker rmi $(DOCKER_HUB_ORG)/$(ENGINE_IMAGE):$(STATIC_VERSION) -rm -f image-linux @@ -32,13 +33,13 @@ $(ENGINE_DIR)/Dockerfile.engine: image-linux: $(ENGINE_DIR)/Dockerfile.engine docker build -t $(DOCKER_HUB_ORG)/$(ENGINE_IMAGE):$(STATIC_VERSION).$(ARCH) \ --build-arg GO_IMAGE="$(GO_IMAGE)" \ - --build-arg VERSION="$(STATIC_VERSION)" \ - --build-arg GITCOMMIT="$$(cd $(ENGINE_DIR) && git rev-parse --short=7 HEAD)" \ - --build-arg BUILDTIME="$(BUILDTIME)" \ - --build-arg PLATFORM="$(PLATFORM)" \ - --build-arg PRODUCT="$(PRODUCT)" \ - --build-arg DEFAULT_PRODUCT_LICENSE="$(DEFAULT_PRODUCT_LICENSE)" \ - --file $< $(ENGINE_DIR) + --build-arg VERSION="$(STATIC_VERSION)" \ + --build-arg GITCOMMIT="$$(cd $(ENGINE_DIR) && git rev-parse --short=7 HEAD)" \ + --build-arg BUILDTIME="$(BUILDTIME)" \ + --build-arg PLATFORM="$(PLATFORM)" \ + --build-arg PRODUCT="$(PRODUCT)" \ + --build-arg DEFAULT_PRODUCT_LICENSE="$(DEFAULT_PRODUCT_LICENSE)" \ + --file $< $(ENGINE_DIR) echo $(DOCKER_HUB_ORG)/$(ENGINE_IMAGE):$(STATIC_VERSION).$(ARCH) > $@ engine-$(ARCH).tar: image-linux From 45b43d2050d837e34f0d9f3b114c417cdb82c33a Mon Sep 17 00:00:00 2001 From: Eli Uriegas Date: Wed, 22 Aug 2018 23:24:42 +0000 Subject: [PATCH 3/4] Wire up dependencies for debian, source -> . Signed-off-by: Eli Uriegas (cherry picked from commit 99bbb6e33f46b6e2621204aac3b05344783ccfaa) Signed-off-by: Eli Uriegas Upstream-commit: 3aeb8e9365fefea1be6e6b64624fccb81d5a70ad Component: packaging --- components/packaging/image/Dockerfile.engine | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/components/packaging/image/Dockerfile.engine b/components/packaging/image/Dockerfile.engine index b13edb552f..ec6c94d074 100644 --- a/components/packaging/image/Dockerfile.engine +++ b/components/packaging/image/Dockerfile.engine @@ -6,16 +6,16 @@ COPY hack/dockerfile/install/tini.installer / COPY hack/dockerfile/install/proxy.installer / RUN apt-get update && apt-get install -y \ bash \ - btrfs-progs-dev \ + btrfs-tools \ ca-certificates \ cmake \ gcc \ git \ libc-dev \ - libgcc \ - libltdl \ + libgcc-6-dev \ + libltdl-dev \ libtool \ - linux-headers \ + linux-headers-$(dpkg --print-architecture) \ make RUN grep "_COMMIT=" /*.installer |cut -f2- -d: > /binaries-commits @@ -47,7 +47,7 @@ RUN go build -o /sbin/dockerd \ FROM builder as proxy-builder RUN git clone https://github.com/docker/libnetwork.git /go/src/github.com/docker/libnetwork WORKDIR /go/src/github.com/docker/libnetwork -RUN source /binaries-commits && \ +RUN . /binaries-commits && \ git checkout -q "$LIBNETWORK_COMMIT" && \ CGO_ENABLED=0 go build -buildmode=pie -ldflags="$PROXY_LDFLAGS" \ -o /sbin/docker-proxy \ @@ -57,17 +57,17 @@ RUN source /binaries-commits && \ FROM builder as init-builder RUN git clone https://github.com/krallin/tini.git /tini WORKDIR /tini -RUN source /binaries-commits && \ +RUN . /binaries-commits && \ git checkout -q "$TINI_COMMIT" && \ cmake . && make tini-static && \ cp tini-static /sbin/docker-init # runc FROM builder as runc-builder -RUN apk --update add libseccomp-dev +RUN apt-get install -y libseccomp-dev RUN git clone https://github.com/opencontainers/runc.git /go/src/github.com/opencontainers/runc WORKDIR /go/src/github.com/opencontainers/runc -RUN source /binaries-commits && \ +RUN . /binaries-commits && \ git checkout -q "$RUNC_COMMIT" && \ make BUILDTAGS='seccomp apparmor' static && make install From 6c6bc2f8c9fdc3a6d0795fcfd790da972559f812 Mon Sep 17 00:00:00 2001 From: Eli Uriegas Date: Thu, 23 Aug 2018 15:08:24 +0000 Subject: [PATCH 4/4] Remove linux-headers as a dependency Signed-off-by: Eli Uriegas Upstream-commit: 82258262f90bfaca3a2ef14e6b53238c2fac3147 Component: packaging --- components/packaging/image/Dockerfile.engine | 1 - 1 file changed, 1 deletion(-) diff --git a/components/packaging/image/Dockerfile.engine b/components/packaging/image/Dockerfile.engine index ec6c94d074..9242dcdc67 100644 --- a/components/packaging/image/Dockerfile.engine +++ b/components/packaging/image/Dockerfile.engine @@ -15,7 +15,6 @@ RUN apt-get update && apt-get install -y \ libgcc-6-dev \ libltdl-dev \ libtool \ - linux-headers-$(dpkg --print-architecture) \ make RUN grep "_COMMIT=" /*.installer |cut -f2- -d: > /binaries-commits