From c1e6e33c26be907067c26ffa3230a3788d0d3a71 Mon Sep 17 00:00:00 2001 From: Rintaro Okamura Date: Fri, 25 Sep 2020 18:30:19 +0900 Subject: [PATCH] :recycle: use golang:xxx-buster image as base Signed-off-by: Rintaro Okamura --- Makefile.d/docker.mk | 4 +++- dockers/agent/core/ngt/Dockerfile | 3 ++- dockers/base/Dockerfile | 12 +++++------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Makefile.d/docker.mk b/Makefile.d/docker.mk index 7f8893bb602..6ee3bbf2b08 100644 --- a/Makefile.d/docker.mk +++ b/Makefile.d/docker.mk @@ -39,7 +39,8 @@ docker/build/base: $(DOCKER) build \ $(DOCKER_OPTS) \ -f dockers/base/Dockerfile \ - -t $(REPO)/$(BASE_IMAGE) . + -t $(REPO)/$(BASE_IMAGE) . \ + --build-arg GO_VERSION=$(GO_VERSION) .PHONY: docker/name/agent-ngt docker/name/agent-ngt: @@ -52,6 +53,7 @@ docker/build/agent-ngt: docker/build/base $(DOCKER_OPTS) \ -f dockers/agent/core/ngt/Dockerfile \ -t $(REPO)/$(AGENT_IMAGE):$(TAG) . \ + --build-arg BASE_TAG=$(TAG) \ --build-arg DISTROLESS_IMAGE=$(DISTROLESS_IMAGE) \ --build-arg DISTROLESS_IMAGE_TAG=$(DISTROLESS_IMAGE_TAG) \ --build-arg UPX_OPTIONS=$(UPX_OPTIONS) diff --git a/dockers/agent/core/ngt/Dockerfile b/dockers/agent/core/ngt/Dockerfile index fe5050d1a29..ece233e9b49 100644 --- a/dockers/agent/core/ngt/Dockerfile +++ b/dockers/agent/core/ngt/Dockerfile @@ -14,11 +14,12 @@ # limitations under the License. # +ARG BASE_TAG=latest ARG DISTROLESS_IMAGE=gcr.io/distroless/static ARG DISTROLESS_IMAGE_TAG=nonroot ARG UPX_OPTIONS=-9 -FROM vdaas/vald-base:latest AS builder +FROM vdaas/vald-base:${BASE_TAG} AS builder ARG UPX_OPTIONS ENV ORG vdaas diff --git a/dockers/base/Dockerfile b/dockers/base/Dockerfile index 7f151302b9f..01b4e8cb3d4 100644 --- a/dockers/base/Dockerfile +++ b/dockers/base/Dockerfile @@ -13,6 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # +ARG GO_VERSION + +FROM golang:${GO_VERSION}-buster AS golang FROM ubuntu:devel AS builder @@ -36,13 +39,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -WORKDIR /opt -COPY versions/GO_VERSION . -RUN export GO_VERSION="$(cat GO_VERSION)" \ - && curl -sSL -O "https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz" \ - && tar zxf "go${GO_VERSION}.linux-amd64.tar.gz" \ - && rm "go${GO_VERSION}.linux-amd64.tar.gz" \ - && ln -s /opt/go/bin/go /usr/bin/ \ +COPY --from=golang /usr/local/go /opt/go +RUN ln -s /opt/go/bin/go /usr/bin/ \ && mkdir $GOPATH WORKDIR ${GOPATH}/src/github.com/vdaas/vald