Make GO_IMAGE configurable, default to official go

Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
(cherry picked from commit 4cdbe08bf929d5c731b61e1cea217fa40156a3a8)
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
Upstream-commit: 5bfb6ce9464fea13abc71fb6c12b9f5cb01a29a4
Component: packaging
This commit is contained in:
Eli Uriegas
2018-08-22 23:11:53 +00:00
parent bd24fd7ae6
commit cea6d4e302
2 changed files with 22 additions and 8 deletions

View File

@ -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

View File

@ -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)" \