diff --git a/dockers/tools/benchmark/job/Dockerfile b/dockers/tools/benchmark/job/Dockerfile index a6251e3075d..dddc01da1b0 100644 --- a/dockers/tools/benchmark/job/Dockerfile +++ b/dockers/tools/benchmark/job/Dockerfile @@ -13,12 +13,15 @@ # See the License for the specific language governing permissions and # 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 golang:${GO_VERSION} AS golang + FROM ubuntu:devel AS builder ARG UPX_OPTIONS @@ -47,17 +50,19 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -RUN mkdir -p ${GOPATH}/src - COPY --from=golang /usr/local/go $GOROOT RUN mkdir -p "$GOPATH/src" -WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO} +WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/Makefile.d +COPY Makefile.d . +WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO} +COPY Makefile . +COPY .git . COPY go.mod . COPY go.sum . -RUN go mod download +RUN make go/download WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal COPY internal . @@ -74,14 +79,7 @@ COPY cmd/${PKG} . WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/versions COPY versions . -WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/Makefile.d -COPY Makefile.d . - WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO} -COPY Makefile . - -COPY .git . - RUN make REPO=${ORG} NAME=${REPO} cmd/${PKG}/${APP_NAME} \ && upx ${UPX_OPTIONS} -o "/usr/bin/${APP_NAME}" "cmd/${PKG}/${APP_NAME}" @@ -89,7 +87,7 @@ WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/cmd/${PKG} RUN cp sample.yaml /tmp/config.yaml FROM ${DISTROLESS_IMAGE}:${DISTROLESS_IMAGE_TAG} -LABEL maintainer "Vald team " +LABEL maintainer="${MAINTAINER}" ENV APP_NAME job COPY --from=builder /usr/lib/x86_64-linux-gnu/libaec* /usr/lib/x86_64-linux-gnu/ diff --git a/dockers/tools/benchmark/operator/Dockerfile b/dockers/tools/benchmark/operator/Dockerfile index b930f92d046..1b3a8ee0fa1 100644 --- a/dockers/tools/benchmark/operator/Dockerfile +++ b/dockers/tools/benchmark/operator/Dockerfile @@ -20,6 +20,8 @@ ARG DISTROLESS_IMAGE_TAG=nonroot ARG UPX_OPTIONS=-9 ARG MAINTAINER="vdaas.org vald team " +FROM golang:${GO_VERSION} AS golang + FROM ubuntu:devel AS builder ENV GO111MODULE on @@ -50,8 +52,12 @@ RUN mkdir -p ${GOPATH}/src COPY --from=golang /usr/local/go $GOROOT RUN mkdir -p "$GOPATH/src" -WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO} +WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/Makefile.d +COPY Makefile.d . +WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO} +COPY Makefile . +COPY .git . COPY go.mod . COPY go.sum . @@ -72,14 +78,7 @@ COPY cmd/${PKG} . WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/versions COPY versions . -WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/Makefile.d -COPY Makefile.d . - WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO} -COPY Makefile . - -COPY .git . - RUN make REPO=${ORG} NAME=${REPO} cmd/${PKG}/${APP_NAME} \ && upx ${UPX_OPTIONS} -o "/usr/bin/${APP_NAME}" "cmd/${PKG}/${APP_NAME}" @@ -87,7 +86,7 @@ WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/cmd/${PKG} RUN cp sample.yaml /tmp/config.yaml FROM ${DISTROLESS_IMAGE}:${DISTROLESS_IMAGE_TAG} -LABEL maintainer "Vald team " +LABEL maintainer="${MAINTAINER}" ENV APP_NAME operator COPY --from=builder /usr/bin/${APP_NAME} /go/bin/${APP_NAME}