diff --git a/.deepsource.toml b/.deepsource.toml index c580273ce2..c3037bdd5d 100644 --- a/.deepsource.toml +++ b/.deepsource.toml @@ -37,7 +37,6 @@ enabled = true [analyzers.meta] dockerfile_paths = [ - "dockers/base/Dockerfile", "dockers/agent/ngt/Dockerfile", "dockers/discoverer/k8s/Dockerfile", "dockers/gateway/vald/Dockerfile", diff --git a/.github/workflows/dockers-agent-ngt-image.yml b/.github/workflows/dockers-agent-ngt-image.yml index c966c92d5a..14c65f128b 100644 --- a/.github/workflows/dockers-agent-ngt-image.yml +++ b/.github/workflows/dockers-agent-ngt-image.yml @@ -33,7 +33,6 @@ on: - "apis/grpc/**" - "pkg/agent/core/ngt/**" - "cmd/agent/core/ngt/**" - - "dockers/base/Dockerfile" - "dockers/agent/core/ngt/Dockerfile" - "versions/GO_VERSION" - "versions/NGT_VERSION" @@ -48,8 +47,6 @@ on: - "apis/grpc/**" - "pkg/agent/core/ngt/**" - "cmd/agent/core/ngt/**" - - "dockers/base/Dockerfile" - - "dockers/agent/core/ngt/Dockerfile" - "versions/GO_VERSION" - "versions/NGT_VERSION" diff --git a/.github/workflows/dockers-agent-sidecar-image.yml b/.github/workflows/dockers-agent-sidecar-image.yml index 432f459e4b..44f7ae4d29 100644 --- a/.github/workflows/dockers-agent-sidecar-image.yml +++ b/.github/workflows/dockers-agent-sidecar-image.yml @@ -34,7 +34,6 @@ on: - "apis/grpc/**" - "pkg/agent/sidecar/**" - "cmd/agent/sidecar/**" - - "dockers/base/Dockerfile" - "dockers/agent/sidecar/Dockerfile" - "versions/GO_VERSION" pull_request: @@ -49,7 +48,6 @@ on: - "apis/grpc/**" - "pkg/agent/sidecar/**" - "cmd/agent/sidecar/**" - - "dockers/base/Dockerfile" - "dockers/agent/sidecar/Dockerfile" - "versions/GO_VERSION" diff --git a/.github/workflows/dockers-backup-manager-cassandra-image.yml b/.github/workflows/dockers-backup-manager-cassandra-image.yml index 1cadc3576c..dcef0c0dea 100644 --- a/.github/workflows/dockers-backup-manager-cassandra-image.yml +++ b/.github/workflows/dockers-backup-manager-cassandra-image.yml @@ -34,7 +34,6 @@ on: - "apis/grpc/**" - "pkg/manager/backup/cassandra/**" - "cmd/manager/backup/cassandra/**" - - "dockers/base/Dockerfile" - "dockers/manager/backup/cassandra/Dockerfile" - "versions/GO_VERSION" - "versions/NGT_VERSION" @@ -50,7 +49,6 @@ on: - "apis/grpc/**" - "pkg/manager/backup/cassandra/**" - "cmd/manager/backup/cassandra/**" - - "dockers/base/Dockerfile" - "dockers/manager/backup/cassandra/Dockerfile" - "versions/GO_VERSION" - "versions/NGT_VERSION" diff --git a/.github/workflows/dockers-backup-manager-mysql-image.yml b/.github/workflows/dockers-backup-manager-mysql-image.yml index 5315256cc8..56878ed6bc 100644 --- a/.github/workflows/dockers-backup-manager-mysql-image.yml +++ b/.github/workflows/dockers-backup-manager-mysql-image.yml @@ -34,7 +34,6 @@ on: - "apis/grpc/**" - "pkg/manager/backup/mysql/**" - "cmd/manager/backup/mysql/**" - - "dockers/base/Dockerfile" - "dockers/manager/backup/mysql/Dockerfile" - "versions/GO_VERSION" pull_request: @@ -49,7 +48,6 @@ on: - "apis/grpc/**" - "pkg/manager/backup/mysql/**" - "cmd/manager/backup/mysql/**" - - "dockers/base/Dockerfile" - "dockers/manager/backup/mysql/Dockerfile" - "versions/GO_VERSION" diff --git a/.github/workflows/dockers-base-image.yml b/.github/workflows/dockers-base-image.yml deleted file mode 100644 index 9aa829218c..0000000000 --- a/.github/workflows/dockers-base-image.yml +++ /dev/null @@ -1,71 +0,0 @@ -# -# Copyright (C) 2019-2021 vdaas.org vald team -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -name: "Build docker image: base" -on: - push: - branches: - - master - paths: - - "go.mod" - - "go.sum" - - "Makefile" - - "dockers/base/Dockerfile" - - "versions/GO_VERSION" - pull_request: - paths: - - "go.mod" - - "go.sum" - - "Makefile" - - "dockers/base/Dockerfile" - - "versions/GO_VERSION" - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Setup QEMU - uses: docker/setup-qemu-action@v1 - with: - platforms: all - - name: Setup Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v1 - with: - buildkitd-flags: "--debug" - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USER }} - password: ${{ secrets.DOCKERHUB_PASS }} - - name: Login to GitHub Container Registry - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ secrets.PACKAGE_USER }} - password: ${{ secrets.PACKAGE_TOKEN }} - - name: Specify platforms - id: specify_platforms - run: | - base_platforms=`make docker/platforms` - echo "::set-output name=BASE_PLATFORMS::${base_platforms}" - - name: Build and Publish - id: build_and_publish - uses: ./.github/actions/docker-build - with: - target: base - builder: ${{ steps.buildx.outputs.name }} - platforms: ${{ steps.specify_platforms.outputs.BASE_PLATFORMS }} diff --git a/.github/workflows/dockers-discoverer-k8s-image.yml b/.github/workflows/dockers-discoverer-k8s-image.yml index 03342d5a6f..bb0b28987a 100644 --- a/.github/workflows/dockers-discoverer-k8s-image.yml +++ b/.github/workflows/dockers-discoverer-k8s-image.yml @@ -32,7 +32,6 @@ on: - "apis/grpc/**" - "pkg/discoverer/k8s/**" - "cmd/discoverer/k8s/**" - - "dockers/base/Dockerfile" - "dockers/discoverer/k8s/Dockerfile" - "versions/GO_VERSION" pull_request: @@ -45,7 +44,6 @@ on: - "apis/grpc/**" - "pkg/discoverer/k8s/**" - "cmd/discoverer/k8s/**" - - "dockers/base/Dockerfile" - "dockers/discoverer/k8s/Dockerfile" - "versions/GO_VERSION" diff --git a/.github/workflows/dockers-gateway-backup-image.yml b/.github/workflows/dockers-gateway-backup-image.yml index 768ac9e4ba..137f79803f 100644 --- a/.github/workflows/dockers-gateway-backup-image.yml +++ b/.github/workflows/dockers-gateway-backup-image.yml @@ -35,7 +35,6 @@ on: - "pkg/gateway/backup/**" - "cmd/gateway/backup/**" - "pkg/gateway/internal/**" - - "dockers/base/Dockerfile" - "dockers/gateway/backup/Dockerfile" - "versions/GO_VERSION" pull_request: @@ -51,7 +50,6 @@ on: - "pkg/gateway/backup/**" - "cmd/gateway/backup/**" - "pkg/gateway/internal/**" - - "dockers/base/Dockerfile" - "dockers/gateway/backup/Dockerfile" - "versions/GO_VERSION" diff --git a/.github/workflows/dockers-gateway-filter-image.yml b/.github/workflows/dockers-gateway-filter-image.yml index 8d7c02f33a..6e14248ebe 100644 --- a/.github/workflows/dockers-gateway-filter-image.yml +++ b/.github/workflows/dockers-gateway-filter-image.yml @@ -35,7 +35,6 @@ on: - "pkg/gateway/filter/**" - "cmd/gateway/filter/**" - "pkg/gateway/internal/**" - - "dockers/base/Dockerfile" - "dockers/gateway/filter/Dockerfile" - "versions/GO_VERSION" pull_request: @@ -51,7 +50,6 @@ on: - "pkg/gateway/filter/**" - "cmd/gateway/filter/**" - "pkg/gateway/internal/**" - - "dockers/base/Dockerfile" - "dockers/gateway/filter/Dockerfile" - "versions/GO_VERSION" diff --git a/.github/workflows/dockers-gateway-lb-image.yml b/.github/workflows/dockers-gateway-lb-image.yml index 774adcbc2d..8ed5aa24e7 100644 --- a/.github/workflows/dockers-gateway-lb-image.yml +++ b/.github/workflows/dockers-gateway-lb-image.yml @@ -35,7 +35,6 @@ on: - "pkg/gateway/lb/**" - "cmd/gateway/lb/**" - "pkg/gateway/internal/**" - - "dockers/base/Dockerfile" - "dockers/gateway/lb/Dockerfile" - "versions/GO_VERSION" pull_request: @@ -51,7 +50,6 @@ on: - "pkg/gateway/lb/**" - "cmd/gateway/lb/**" - "pkg/gateway/internal/**" - - "dockers/base/Dockerfile" - "dockers/gateway/lb/Dockerfile" - "versions/GO_VERSION" diff --git a/.github/workflows/dockers-gateway-meta-image.yml b/.github/workflows/dockers-gateway-meta-image.yml index 9d40155257..42a2fefeed 100644 --- a/.github/workflows/dockers-gateway-meta-image.yml +++ b/.github/workflows/dockers-gateway-meta-image.yml @@ -35,7 +35,6 @@ on: - "pkg/gateway/meta/**" - "cmd/gateway/meta/**" - "pkg/gateway/internal/**" - - "dockers/base/Dockerfile" - "dockers/gateway/meta/Dockerfile" - "versions/GO_VERSION" pull_request: @@ -51,7 +50,6 @@ on: - "pkg/gateway/meta/**" - "cmd/gateway/meta/**" - "pkg/gateway/internal/**" - - "dockers/base/Dockerfile" - "dockers/gateway/meta/Dockerfile" - "versions/GO_VERSION" diff --git a/.github/workflows/dockers-gateway-vald-image.yml b/.github/workflows/dockers-gateway-vald-image.yml index a73b744c89..88c271b67a 100644 --- a/.github/workflows/dockers-gateway-vald-image.yml +++ b/.github/workflows/dockers-gateway-vald-image.yml @@ -33,7 +33,6 @@ on: - "apis/grpc/**" - "pkg/gateway/vald/**" - "cmd/gateway/vald/**" - - "dockers/base/Dockerfile" - "dockers/gateway/vald/Dockerfile" - "versions/GO_VERSION" pull_request: @@ -47,7 +46,6 @@ on: - "apis/grpc/**" - "pkg/gateway/vald/**" - "cmd/gateway/vald/**" - - "dockers/base/Dockerfile" - "dockers/gateway/vald/Dockerfile" - "versions/GO_VERSION" diff --git a/.github/workflows/dockers-loadtest-image.yml b/.github/workflows/dockers-loadtest-image.yml index 8f101d228b..27a2be81e3 100644 --- a/.github/workflows/dockers-loadtest-image.yml +++ b/.github/workflows/dockers-loadtest-image.yml @@ -33,7 +33,6 @@ on: - "apis/grpc/**" - "pkg/tools/cli/loadtest/**" - "cmd/tools/cli/loadtest/**" - - "dockers/base/Dockerfile" - "dockers/tools/cli/loadtest/Dockerfile" - "versions/GO_VERSION" pull_request: @@ -47,7 +46,6 @@ on: - "apis/grpc/**" - "pkg/tools/cli/loadtest/**" - "cmd/tools/cli/loadtest/**" - - "dockers/base/Dockerfile" - "dockers/tools/cli/loadtest/Dockerfile" - "versions/GO_VERSION" diff --git a/.github/workflows/dockers-manager-compressor-image.yml b/.github/workflows/dockers-manager-compressor-image.yml index e3d51aec59..187e46d225 100644 --- a/.github/workflows/dockers-manager-compressor-image.yml +++ b/.github/workflows/dockers-manager-compressor-image.yml @@ -33,7 +33,6 @@ on: - "apis/grpc/**" - "pkg/manager/compressor/**" - "cmd/manager/compressor/**" - - "dockers/base/Dockerfile" - "dockers/manager/compressor/Dockerfile" - "versions/GO_VERSION" pull_request: @@ -47,7 +46,6 @@ on: - "apis/grpc/**" - "pkg/manager/compressor/**" - "cmd/manager/compressor/**" - - "dockers/base/Dockerfile" - "dockers/manager/compressor/Dockerfile" - "versions/GO_VERSION" diff --git a/.github/workflows/dockers-manager-index-image.yml b/.github/workflows/dockers-manager-index-image.yml index f33a5e77da..e7c7490a0d 100644 --- a/.github/workflows/dockers-manager-index-image.yml +++ b/.github/workflows/dockers-manager-index-image.yml @@ -33,7 +33,6 @@ on: - "apis/grpc/**" - "pkg/manager/index/**" - "cmd/manager/index/**" - - "dockers/base/Dockerfile" - "dockers/manager/index/Dockerfile" - "versions/GO_VERSION" pull_request: @@ -47,7 +46,6 @@ on: - "apis/grpc/**" - "pkg/manager/index/**" - "cmd/manager/index/**" - - "dockers/base/Dockerfile" - "dockers/manager/index/Dockerfile" - "versions/GO_VERSION" diff --git a/.github/workflows/dockers-meta-cassandra-image.yml b/.github/workflows/dockers-meta-cassandra-image.yml index ab808eb37e..af157e0f11 100644 --- a/.github/workflows/dockers-meta-cassandra-image.yml +++ b/.github/workflows/dockers-meta-cassandra-image.yml @@ -34,7 +34,6 @@ on: - "apis/grpc/**" - "pkg/meta/cassandra/**" - "cmd/meta/cassandra/**" - - "dockers/base/Dockerfile" - "dockers/meta/cassandra/Dockerfile" - "versions/GO_VERSION" pull_request: @@ -49,7 +48,6 @@ on: - "apis/grpc/**" - "pkg/meta/cassandra/**" - "cmd/meta/cassandra/**" - - "dockers/base/Dockerfile" - "dockers/meta/cassandra/Dockerfile" - "versions/GO_VERSION" diff --git a/.github/workflows/dockers-meta-redis-image.yml b/.github/workflows/dockers-meta-redis-image.yml index 2d798e0b31..d88522344b 100644 --- a/.github/workflows/dockers-meta-redis-image.yml +++ b/.github/workflows/dockers-meta-redis-image.yml @@ -34,7 +34,6 @@ on: - "apis/grpc/**" - "pkg/meta/redis/**" - "cmd/meta/redis/**" - - "dockers/base/Dockerfile" - "dockers/meta/redis/Dockerfile" - "versions/GO_VERSION" pull_request: @@ -49,7 +48,6 @@ on: - "apis/grpc/**" - "pkg/meta/redis/**" - "cmd/meta/redis/**" - - "dockers/base/Dockerfile" - "dockers/meta/redis/Dockerfile" - "versions/GO_VERSION" diff --git a/Makefile b/Makefile index 68dcd33e62..e5d16c0456 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,6 @@ GOPKG = github.com/$(ORG)/$(NAME) GOPRIVATE = $(GOPKG),$(GOPKG)/apis DATETIME = $(eval DATETIME := $(shell date -u +%Y/%m/%d_%H:%M:%S%z))$(DATETIME) TAG ?= latest -BASE_IMAGE = $(NAME)-base AGENT_IMAGE = $(NAME)-agent-ngt AGENT_SIDECAR_IMAGE = $(NAME)-agent-sidecar BACKUP_GATEWAY_IMAGE = $(NAME)-backup-gateway diff --git a/Makefile.d/docker.mk b/Makefile.d/docker.mk index ee706aa1d4..3d37e7013d 100644 --- a/Makefile.d/docker.mk +++ b/Makefile.d/docker.mk @@ -16,7 +16,6 @@ .PHONY: docker/build ## build all docker images docker/build: \ - docker/build/base \ docker/build/agent-ngt \ docker/build/agent-sidecar \ docker/build/discoverer-k8s \ @@ -45,20 +44,6 @@ docker/name/org/alter: docker/platforms: @echo "linux/amd64,linux/arm64" -.PHONY: docker/name/base -docker/name/base: - @echo "$(ORG)/$(BASE_IMAGE)" - -.PHONY: docker/build/base -## build base image -docker/build/base: - $(DOCKER) build \ - $(DOCKER_OPTS) \ - -f dockers/base/Dockerfile \ - -t $(ORG)/$(BASE_IMAGE):$(TAG) . \ - --build-arg MAINTAINER=$(MAINTAINER) \ - --build-arg GO_VERSION=$(GO_VERSION) - .PHONY: docker/name/agent-ngt docker/name/agent-ngt: @echo "$(ORG)/$(AGENT_IMAGE)" diff --git a/dockers/agent/core/ngt/Dockerfile b/dockers/agent/core/ngt/Dockerfile index 04e0923cb8..7f15da0cc9 100644 --- a/dockers/agent/core/ngt/Dockerfile +++ b/dockers/agent/core/ngt/Dockerfile @@ -15,7 +15,6 @@ # ARG GO_VERSION=latest -ARG BASE_TAG=latest ARG DISTROLESS_IMAGE=gcr.io/distroless/static ARG DISTROLESS_IMAGE_TAG=nonroot ARG UPX_OPTIONS=-9 @@ -23,16 +22,45 @@ ARG MAINTAINER="vdaas.org vald team " FROM golang:${GO_VERSION} AS golang -FROM vdaas/vald-base:${BASE_TAG} AS builder +FROM ubuntu:devel AS builder + ARG UPX_OPTIONS +ENV GO111MODULE on +ENV DEBIAN_FRONTEND noninteractive +ENV INITRD No +ENV LANG en_US.UTF-8 +ENV GOROOT /opt/go +ENV GOPATH /go +ENV PATH ${PATH}:${GOROOT}/bin:${GOPATH}/bin ENV ORG vdaas ENV REPO vald ENV PKG agent/core/ngt ENV PKG_INTERNAL agent/internal ENV APP_NAME ngt +RUN apt-get update && apt-get install -y --no-install-recommends \ + ca-certificates \ + build-essential \ + cmake \ + upx \ + curl \ + unzip \ + git \ + gcc \ + g++ \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + COPY --from=golang /usr/local/go $GOROOT +RUN mkdir $GOPATH + +WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO} + +COPY go.mod . +COPY go.sum . + +RUN go mod download WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal COPY internal . diff --git a/dockers/agent/sidecar/Dockerfile b/dockers/agent/sidecar/Dockerfile index 82a8470fa4..cc3f0a613c 100644 --- a/dockers/agent/sidecar/Dockerfile +++ b/dockers/agent/sidecar/Dockerfile @@ -15,24 +15,37 @@ # ARG GO_VERSION=latest -ARG BASE_TAG=latest ARG DISTROLESS_IMAGE=gcr.io/distroless/static ARG DISTROLESS_IMAGE_TAG=nonroot ARG UPX_OPTIONS=-9 ARG MAINTAINER="vdaas.org vald team " -FROM golang:${GO_VERSION} AS golang +FROM golang:${GO_VERSION} AS builder -FROM vdaas/vald-base:${BASE_TAG} AS builder ARG UPX_OPTIONS +ENV GO111MODULE on +ENV LANG en_US.UTF-8 ENV ORG vdaas ENV REPO vald ENV PKG agent/sidecar ENV PKG_INTERNAL agent/internal ENV APP_NAME sidecar -COPY --from=golang /usr/local/go $GOROOT +RUN apt-get update && apt-get install -y --no-install-recommends \ + upx \ + git \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p $GOPATH/src + +WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO} + +COPY go.mod . +COPY go.sum . + +RUN go mod download WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal COPY internal . diff --git a/dockers/base/Dockerfile b/dockers/base/Dockerfile deleted file mode 100644 index caf7c4013f..0000000000 --- a/dockers/base/Dockerfile +++ /dev/null @@ -1,53 +0,0 @@ -# -# Copyright (C) 2019-2021 vdaas.org vald team -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -ARG GO_VERSION=latest -ARG MAINTAINER="vdaas.org vald team " - -FROM golang:${GO_VERSION} AS golang - -FROM ubuntu:devel AS builder -LABEL maintainer "${MAINTAINER}" - -ENV GO111MODULE on -ENV DEBIAN_FRONTEND noninteractive -ENV INITRD No -ENV LANG en_US.UTF-8 -ENV GOROOT /opt/go -ENV GOPATH /go -ENV PATH ${PATH}:${GOROOT}/bin:${GOPATH}/bin - -RUN apt-get update && apt-get install -y --no-install-recommends \ - ca-certificates \ - build-essential \ - cmake \ - upx \ - curl \ - unzip \ - git \ - gcc \ - g++ \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* - -COPY --from=golang /usr/local/go $GOROOT -RUN mkdir $GOPATH - -WORKDIR ${GOPATH}/src/github.com/vdaas/vald - -COPY go.mod . -COPY go.sum . - -RUN go mod download diff --git a/dockers/ci/base/Dockerfile b/dockers/ci/base/Dockerfile index b89b48b941..1809a96cc3 100644 --- a/dockers/ci/base/Dockerfile +++ b/dockers/ci/base/Dockerfile @@ -15,28 +15,45 @@ # ARG GO_VERSION=latest -ARG BASE_TAG=latest ARG MAINTAINER="vdaas.org vald team " FROM golang:${GO_VERSION} AS golang -FROM vdaas/vald-base:${BASE_TAG} AS builder +FROM ubuntu:devel AS builder ARG PROTOBUF_VERSION=3.14.0 -ARG GOLANGCI_LINT_VERSION=v1.35.2 +ARG GOLANGCI_LINT_VERSION=v1.36.0 ARG REVIEWDOG_VERSION=v0.11.0 -ARG YQ_VERSION=4.3.2 +ARG YQ_VERSION=4.5.0 + LABEL maintainer "${MAINTAINER}" +ENV GO111MODULE on +ENV DEBIAN_FRONTEND noninteractive +ENV INITRD No +ENV LANG en_US.UTF-8 +ENV GOROOT /opt/go +ENV GOPATH /go +ENV PATH ${PATH}:${GOROOT}/bin:${GOPATH}/bin + COPY --from=golang /usr/local/go $GOROOT +RUN mkdir -p $GOPATH/src RUN apt-get update && apt-get install -y --no-install-recommends \ - libhdf5-dev \ - graphviz \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + g++ \ gawk \ + gcc \ + git \ + graphviz \ + jq \ + libhdf5-dev \ nodejs \ npm \ - jq \ sed \ + unzip \ zip \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* @@ -50,6 +67,8 @@ RUN curl -OL "https://github.com/google/protobuf/releases/download/v${PROTOBUF_V WORKDIR ${GOPATH}/src/github.com/vdaas/vald +COPY go.mod . +COPY go.sum . COPY Makefile . COPY Makefile.d Makefile.d COPY apis/proto apis/proto diff --git a/dockers/dev/Dockerfile b/dockers/dev/Dockerfile index 6f86d4f68d..c89227d3e2 100644 --- a/dockers/dev/Dockerfile +++ b/dockers/dev/Dockerfile @@ -14,14 +14,20 @@ # limitations under the License. # -ARG BASE_TAG=latest ARG MAINTAINER="vdaas.org vald team " -FROM vdaas/vald-base:${BASE_TAG} AS builder +FROM ubuntu:devel AS builder ARG PROTOBUF_VERSION=3.14.0 -ARG GOLANGCI_LINT_VERSION=v1.35.2 +ARG GOLANGCI_LINT_VERSION=v1.36.0 ARG REVIEWDOG_VERSION=v0.11.0 -ARG YQ_VERSION=4.3.2 +ARG YQ_VERSION=4.5.0 + +RUN apt-get update && apt-get install -y --no-install-recommends \ + ca-certificates \ + curl \ + unzip \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* WORKDIR /tmp diff --git a/dockers/discoverer/k8s/Dockerfile b/dockers/discoverer/k8s/Dockerfile index ffefa98553..31d007279e 100644 --- a/dockers/discoverer/k8s/Dockerfile +++ b/dockers/discoverer/k8s/Dockerfile @@ -15,23 +15,36 @@ # ARG GO_VERSION=latest -ARG BASE_TAG=latest ARG DISTROLESS_IMAGE=gcr.io/distroless/static ARG DISTROLESS_IMAGE_TAG=nonroot ARG UPX_OPTIONS=-9 ARG MAINTAINER="vdaas.org vald team " -FROM golang:${GO_VERSION} AS golang +FROM golang:${GO_VERSION} AS builder -FROM vdaas/vald-base:${BASE_TAG} AS builder ARG UPX_OPTIONS +ENV GO111MODULE on +ENV LANG en_US.UTF-8 ENV ORG vdaas ENV REPO vald ENV PKG discoverer/k8s ENV APP_NAME discoverer -COPY --from=golang /usr/local/go $GOROOT +RUN apt-get update && apt-get install -y --no-install-recommends \ + upx \ + git \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p $GOPATH/src + +WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO} + +COPY go.mod . +COPY go.sum . + +RUN go mod download WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal COPY internal . diff --git a/dockers/gateway/backup/Dockerfile b/dockers/gateway/backup/Dockerfile index 4755fc0787..ec59ba086d 100644 --- a/dockers/gateway/backup/Dockerfile +++ b/dockers/gateway/backup/Dockerfile @@ -15,23 +15,36 @@ # ARG GO_VERSION=latest -ARG BASE_TAG=latest ARG DISTROLESS_IMAGE=gcr.io/distroless/static ARG DISTROLESS_IMAGE_TAG=nonroot ARG UPX_OPTIONS=-9 ARG MAINTAINER="vdaas.org vald team " -FROM golang:${GO_VERSION} AS golang +FROM golang:${GO_VERSION} AS builder -FROM vdaas/vald-base:${BASE_TAG} AS builder ARG UPX_OPTIONS +ENV GO111MODULE on +ENV LANG en_US.UTF-8 ENV ORG vdaas ENV REPO vald ENV PKG gateway/backup ENV APP_NAME backup -COPY --from=golang /usr/local/go $GOROOT +RUN apt-get update && apt-get install -y --no-install-recommends \ + upx \ + git \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p $GOPATH/src + +WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO} + +COPY go.mod . +COPY go.sum . + +RUN go mod download WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal COPY internal . diff --git a/dockers/gateway/filter/Dockerfile b/dockers/gateway/filter/Dockerfile index 544633bcfc..350d4402d8 100644 --- a/dockers/gateway/filter/Dockerfile +++ b/dockers/gateway/filter/Dockerfile @@ -15,23 +15,36 @@ # ARG GO_VERSION=latest -ARG BASE_TAG=latest ARG DISTROLESS_IMAGE=gcr.io/distroless/static ARG DISTROLESS_IMAGE_TAG=nonroot ARG UPX_OPTIONS=-9 ARG MAINTAINER="vdaas.org vald team " -FROM golang:${GO_VERSION} AS golang +FROM golang:${GO_VERSION} AS builder -FROM vdaas/vald-base:${BASE_TAG} AS builder ARG UPX_OPTIONS +ENV GO111MODULE on +ENV LANG en_US.UTF-8 ENV ORG vdaas ENV REPO vald ENV PKG gateway/filter ENV APP_NAME filter -COPY --from=golang /usr/local/go $GOROOT +RUN apt-get update && apt-get install -y --no-install-recommends \ + upx \ + git \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p $GOPATH/src + +WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO} + +COPY go.mod . +COPY go.sum . + +RUN go mod download WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal COPY internal . diff --git a/dockers/gateway/lb/Dockerfile b/dockers/gateway/lb/Dockerfile index 3217dc7ada..371b0dc9de 100644 --- a/dockers/gateway/lb/Dockerfile +++ b/dockers/gateway/lb/Dockerfile @@ -15,23 +15,36 @@ # ARG GO_VERSION=latest -ARG BASE_TAG=latest ARG DISTROLESS_IMAGE=gcr.io/distroless/static ARG DISTROLESS_IMAGE_TAG=nonroot ARG UPX_OPTIONS=-9 ARG MAINTAINER="vdaas.org vald team " -FROM golang:${GO_VERSION} AS golang +FROM golang:${GO_VERSION} AS builder -FROM vdaas/vald-base:${BASE_TAG} AS builder ARG UPX_OPTIONS +ENV GO111MODULE on +ENV LANG en_US.UTF-8 ENV ORG vdaas ENV REPO vald ENV PKG gateway/lb ENV APP_NAME lb -COPY --from=golang /usr/local/go $GOROOT +RUN apt-get update && apt-get install -y --no-install-recommends \ + upx \ + git \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p $GOPATH/src + +WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO} + +COPY go.mod . +COPY go.sum . + +RUN go mod download WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal COPY internal . diff --git a/dockers/gateway/meta/Dockerfile b/dockers/gateway/meta/Dockerfile index 481147703c..814c23f32d 100644 --- a/dockers/gateway/meta/Dockerfile +++ b/dockers/gateway/meta/Dockerfile @@ -15,23 +15,36 @@ # ARG GO_VERSION=latest -ARG BASE_TAG=latest ARG DISTROLESS_IMAGE=gcr.io/distroless/static ARG DISTROLESS_IMAGE_TAG=nonroot ARG UPX_OPTIONS=-9 ARG MAINTAINER="vdaas.org vald team " -FROM golang:${GO_VERSION} AS golang +FROM golang:${GO_VERSION} AS builder -FROM vdaas/vald-base:${BASE_TAG} AS builder ARG UPX_OPTIONS +ENV GO111MODULE on +ENV LANG en_US.UTF-8 ENV ORG vdaas ENV REPO vald ENV PKG gateway/meta ENV APP_NAME meta -COPY --from=golang /usr/local/go $GOROOT +RUN apt-get update && apt-get install -y --no-install-recommends \ + upx \ + git \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p $GOPATH/src + +WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO} + +COPY go.mod . +COPY go.sum . + +RUN go mod download WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal COPY internal . diff --git a/dockers/gateway/vald/Dockerfile b/dockers/gateway/vald/Dockerfile index 99b796f071..8f18b84fc5 100644 --- a/dockers/gateway/vald/Dockerfile +++ b/dockers/gateway/vald/Dockerfile @@ -15,23 +15,36 @@ # ARG GO_VERSION=latest -ARG BASE_TAG=latest ARG DISTROLESS_IMAGE=gcr.io/distroless/static ARG DISTROLESS_IMAGE_TAG=nonroot ARG UPX_OPTIONS=-9 ARG MAINTAINER="vdaas.org vald team " -FROM golang:${GO_VERSION} AS golang +FROM golang:${GO_VERSION} AS builder -FROM vdaas/vald-base:${BASE_TAG} AS builder ARG UPX_OPTIONS +ENV GO111MODULE on +ENV LANG en_US.UTF-8 ENV ORG vdaas ENV REPO vald ENV PKG gateway/vald ENV APP_NAME vald -COPY --from=golang /usr/local/go $GOROOT +RUN apt-get update && apt-get install -y --no-install-recommends \ + upx \ + git \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p $GOPATH/src + +WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO} + +COPY go.mod . +COPY go.sum . + +RUN go mod download WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal COPY internal . diff --git a/dockers/manager/backup/cassandra/Dockerfile b/dockers/manager/backup/cassandra/Dockerfile index 0513d82a15..3964c188f8 100644 --- a/dockers/manager/backup/cassandra/Dockerfile +++ b/dockers/manager/backup/cassandra/Dockerfile @@ -15,23 +15,36 @@ # ARG GO_VERSION=latest -ARG BASE_TAG=latest ARG DISTROLESS_IMAGE=gcr.io/distroless/static ARG DISTROLESS_IMAGE_TAG=nonroot ARG UPX_OPTIONS=-9 ARG MAINTAINER="vdaas.org vald team " -FROM golang:${GO_VERSION} AS golang +FROM golang:${GO_VERSION} AS builder -FROM vdaas/vald-base:${BASE_TAG} AS builder ARG UPX_OPTIONS +ENV GO111MODULE on +ENV LANG en_US.UTF-8 ENV ORG vdaas ENV REPO vald ENV PKG manager/backup/cassandra ENV APP_NAME backup -COPY --from=golang /usr/local/go $GOROOT +RUN apt-get update && apt-get install -y --no-install-recommends \ + upx \ + git \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p $GOPATH/src + +WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO} + +COPY go.mod . +COPY go.sum . + +RUN go mod download WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal COPY internal . diff --git a/dockers/manager/backup/mysql/Dockerfile b/dockers/manager/backup/mysql/Dockerfile index fb383db7e2..13d3958dd6 100644 --- a/dockers/manager/backup/mysql/Dockerfile +++ b/dockers/manager/backup/mysql/Dockerfile @@ -15,23 +15,36 @@ # ARG GO_VERSION=latest -ARG BASE_TAG=latest ARG DISTROLESS_IMAGE=gcr.io/distroless/static ARG DISTROLESS_IMAGE_TAG=nonroot ARG UPX_OPTIONS=-9 ARG MAINTAINER="vdaas.org vald team " -FROM golang:${GO_VERSION} AS golang +FROM golang:${GO_VERSION} AS builder -FROM vdaas/vald-base:${BASE_TAG} AS builder ARG UPX_OPTIONS +ENV GO111MODULE on +ENV LANG en_US.UTF-8 ENV ORG vdaas ENV REPO vald ENV PKG manager/backup/mysql ENV APP_NAME backup -COPY --from=golang /usr/local/go $GOROOT +RUN apt-get update && apt-get install -y --no-install-recommends \ + upx \ + git \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p $GOPATH/src + +WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO} + +COPY go.mod . +COPY go.sum . + +RUN go mod download WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal COPY internal . diff --git a/dockers/manager/compressor/Dockerfile b/dockers/manager/compressor/Dockerfile index c7be29b4a5..b372c103f8 100644 --- a/dockers/manager/compressor/Dockerfile +++ b/dockers/manager/compressor/Dockerfile @@ -15,23 +15,36 @@ # ARG GO_VERSION=latest -ARG BASE_TAG=latest ARG DISTROLESS_IMAGE=gcr.io/distroless/static ARG DISTROLESS_IMAGE_TAG=nonroot ARG UPX_OPTIONS=-9 ARG MAINTAINER="vdaas.org vald team " -FROM golang:${GO_VERSION} AS golang +FROM golang:${GO_VERSION} AS builder -FROM vdaas/vald-base:${BASE_TAG} AS builder ARG UPX_OPTIONS +ENV GO111MODULE on +ENV LANG en_US.UTF-8 ENV ORG vdaas ENV REPO vald ENV PKG manager/compressor ENV APP_NAME compressor -COPY --from=golang /usr/local/go $GOROOT +RUN apt-get update && apt-get install -y --no-install-recommends \ + upx \ + git \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p $GOPATH/src + +WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO} + +COPY go.mod . +COPY go.sum . + +RUN go mod download WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal COPY internal . diff --git a/dockers/manager/index/Dockerfile b/dockers/manager/index/Dockerfile index fab4eb5d10..190fbd8a62 100644 --- a/dockers/manager/index/Dockerfile +++ b/dockers/manager/index/Dockerfile @@ -15,23 +15,36 @@ # ARG GO_VERSION=latest -ARG BASE_TAG=latest ARG DISTROLESS_IMAGE=gcr.io/distroless/static ARG DISTROLESS_IMAGE_TAG=nonroot ARG UPX_OPTIONS=-9 ARG MAINTAINER="vdaas.org vald team " -FROM golang:${GO_VERSION} AS golang +FROM golang:${GO_VERSION} AS builder -FROM vdaas/vald-base:${BASE_TAG} AS builder ARG UPX_OPTIONS +ENV GO111MODULE on +ENV LANG en_US.UTF-8 ENV ORG vdaas ENV REPO vald ENV PKG manager/index ENV APP_NAME index -COPY --from=golang /usr/local/go $GOROOT +RUN apt-get update && apt-get install -y --no-install-recommends \ + upx \ + git \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p $GOPATH/src + +WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO} + +COPY go.mod . +COPY go.sum . + +RUN go mod download WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal COPY internal . diff --git a/dockers/manager/replication/agent/Dockerfile b/dockers/manager/replication/agent/Dockerfile index f8ffc608e0..e23ec68b36 100644 --- a/dockers/manager/replication/agent/Dockerfile +++ b/dockers/manager/replication/agent/Dockerfile @@ -14,19 +14,38 @@ # limitations under the License. # +ARG GO_VERSION=latest ARG DISTROLESS_IMAGE=gcr.io/distroless/static ARG DISTROLESS_IMAGE_TAG=nonroot ARG UPX_OPTIONS=-9 ARG MAINTAINER="vdaas.org vald team " -FROM vdaas/vald-base:latest AS builder +FROM golang:${GO_VERSION} AS builder + ARG UPX_OPTIONS +ENV GO111MODULE on +ENV LANG en_US.UTF-8 ENV ORG vdaas ENV REPO vald ENV PKG manager/replication/agent ENV APP_NAME agent +RUN apt-get update && apt-get install -y --no-install-recommends \ + upx \ + git \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p $GOPATH/src + +WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO} + +COPY go.mod . +COPY go.sum . + +RUN go mod download + WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal COPY internal . diff --git a/dockers/manager/replication/controller/Dockerfile b/dockers/manager/replication/controller/Dockerfile index 8c75d1a855..31af3d0e58 100644 --- a/dockers/manager/replication/controller/Dockerfile +++ b/dockers/manager/replication/controller/Dockerfile @@ -14,19 +14,38 @@ # limitations under the License. # +ARG GO_VERSION=latest ARG DISTROLESS_IMAGE=gcr.io/distroless/static ARG DISTROLESS_IMAGE_TAG=nonroot ARG UPX_OPTIONS=-9 ARG MAINTAINER="vdaas.org vald team " -FROM vdaas/vald-base:latest AS builder +FROM golang:${GO_VERSION} AS builder + ARG UPX_OPTIONS +ENV GO111MODULE on +ENV LANG en_US.UTF-8 ENV ORG vdaas ENV REPO vald ENV PKG manager/replication/controller ENV APP_NAME controller +RUN apt-get update && apt-get install -y --no-install-recommends \ + upx \ + git \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p $GOPATH/src + +WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO} + +COPY go.mod . +COPY go.sum . + +RUN go mod download + WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal COPY internal . diff --git a/dockers/meta/cassandra/Dockerfile b/dockers/meta/cassandra/Dockerfile index 97136b99aa..40f8787384 100644 --- a/dockers/meta/cassandra/Dockerfile +++ b/dockers/meta/cassandra/Dockerfile @@ -15,23 +15,36 @@ # ARG GO_VERSION=latest -ARG BASE_TAG=latest ARG DISTROLESS_IMAGE=gcr.io/distroless/static ARG DISTROLESS_IMAGE_TAG=nonroot ARG UPX_OPTIONS=-9 ARG MAINTAINER="vdaas.org vald team " -FROM golang:${GO_VERSION} AS golang +FROM golang:${GO_VERSION} AS builder -FROM vdaas/vald-base:${BASE_TAG} AS builder ARG UPX_OPTIONS +ENV GO111MODULE on +ENV LANG en_US.UTF-8 ENV ORG vdaas ENV REPO vald ENV PKG meta/cassandra ENV APP_NAME meta -COPY --from=golang /usr/local/go $GOROOT +RUN apt-get update && apt-get install -y --no-install-recommends \ + upx \ + git \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p $GOPATH/src + +WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO} + +COPY go.mod . +COPY go.sum . + +RUN go mod download WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal COPY internal . diff --git a/dockers/meta/redis/Dockerfile b/dockers/meta/redis/Dockerfile index f3a61785dd..574e389a81 100644 --- a/dockers/meta/redis/Dockerfile +++ b/dockers/meta/redis/Dockerfile @@ -15,23 +15,36 @@ # ARG GO_VERSION=latest -ARG BASE_TAG=latest ARG DISTROLESS_IMAGE=gcr.io/distroless/static ARG DISTROLESS_IMAGE_TAG=nonroot ARG UPX_OPTIONS=-9 ARG MAINTAINER="vdaas.org vald team " -FROM golang:${GO_VERSION} AS golang +FROM golang:${GO_VERSION} AS builder -FROM vdaas/vald-base:${BASE_TAG} AS builder ARG UPX_OPTIONS +ENV GO111MODULE on +ENV LANG en_US.UTF-8 ENV ORG vdaas ENV REPO vald ENV PKG meta/redis ENV APP_NAME meta -COPY --from=golang /usr/local/go $GOROOT +RUN apt-get update && apt-get install -y --no-install-recommends \ + upx \ + git \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p $GOPATH/src + +WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO} + +COPY go.mod . +COPY go.sum . + +RUN go mod download WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal COPY internal . diff --git a/dockers/operator/helm/Dockerfile b/dockers/operator/helm/Dockerfile index 60d14518f5..8f789ed20a 100644 --- a/dockers/operator/helm/Dockerfile +++ b/dockers/operator/helm/Dockerfile @@ -13,15 +13,15 @@ # See the License for the specific language governing permissions and # limitations under the License. # +ARG GO_VERSION=latest ARG OPERATOR_SDK_VERSION ARG VERSION="v1" ARG GROUP="vald.vdaas.org" ARG VALD_KIND="ValdRelease" ARG VALD_HELM_OPERATOR_KIND="ValdHelmOperatorRelease" -ARG BASE_TAG=latest ARG MAINTAINER="vdaas.org vald team " -FROM vdaas/vald-base:${BASE_TAG} AS builder +FROM golang:${GO_VERSION} AS builder ARG OPERATOR_SDK_VERSION ARG VERSION ARG GROUP @@ -43,6 +43,10 @@ RUN { \ echo " chart: helm-charts/vald-helm-operator"; \ } > /tmp/watches.yaml +WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO} +COPY go.mod . +COPY go.sum . + WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal/errors COPY internal/errors . @@ -63,7 +67,6 @@ COPY Makefile.d . WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO} COPY Makefile . -COPY .git . RUN make helm/schema/vald RUN make helm/schema/vald-helm-operator diff --git a/dockers/tools/cli/loadtest/Dockerfile b/dockers/tools/cli/loadtest/Dockerfile index 254d225a25..e7fad5eb32 100644 --- a/dockers/tools/cli/loadtest/Dockerfile +++ b/dockers/tools/cli/loadtest/Dockerfile @@ -17,23 +17,32 @@ ARG GO_VERSION=latest ARG MAINTAINER="vdaas.org vald team " -FROM golang:${GO_VERSION} AS golang - -FROM vdaas/vald-base:latest AS builder +FROM golang:${GO_VERSION} AS builder +ENV GO111MODULE on +ENV LANG en_US.UTF-8 ENV ORG vdaas ENV REPO vald ENV APP_NAME loadtest ENV PKG tools/cli/${APP_NAME} -COPY --from=golang /usr/local/go $GOROOT - RUN apt-get update && apt-get install -y --no-install-recommends \ + upx \ + git \ libhdf5-dev \ && ldconfig \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* +RUN mkdir -p $GOPATH/src + +WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO} + +COPY go.mod . +COPY go.sum . + +RUN go mod download + WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal COPY internal .