From cea6d4e302816786db557a92b0b35ecdbb22b04a Mon Sep 17 00:00:00 2001 From: Eli Uriegas Date: Wed, 22 Aug 2018 23:11:53 +0000 Subject: [PATCH] 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)" \