From c2b99c9ca8473a9d7ad48f5e4747bd55307ed3ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=88=E8=BE=B0?= Date: Thu, 25 Jan 2024 17:44:06 +0800 Subject: [PATCH] fix docker build problem MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 守辰 --- Dockerfile | 3 +-- Dockerfile_multiarch | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 10d2028..bc9921e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,10 +9,9 @@ COPY go.sum go.sum COPY main.go main.go COPY internal/ internal/ COPY pkg/ pkg/ -COPY vendor/ vendor/ # Build -RUN CGO_ENABLED=0 GO111MODULE=on go build -mod=vendor -a -o kruise-state-metrics main.go +RUN CGO_ENABLED=0 GO111MODULE=on go build -a -o kruise-state-metrics main.go # Use Ubuntu 20.04 LTS as base image to package the binary FROM ubuntu:focal diff --git a/Dockerfile_multiarch b/Dockerfile_multiarch index d57f841..1561b8e 100644 --- a/Dockerfile_multiarch +++ b/Dockerfile_multiarch @@ -12,18 +12,17 @@ COPY go.sum go.sum COPY main.go main.go COPY internal/ internal/ COPY pkg/ pkg/ -COPY vendor/ vendor/ # Build ARG TARGETOS ARG TARGETARCH -RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=0 GO111MODULE=on go build -mod=vendor -a -o kruise-state-metrics main.go +RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=0 GO111MODULE=on go build -a -o kruise-state-metrics main.go ARG BASE_IMAGE ARG BASE_IMAGE_VERION FROM ${BASE_IMAGE}:${BASE_IMAGE_VERION} -RUN apk add --no-cache ca-certificates=~20220614-r4 bash=~5.2.15-r0 expat=~2.5.0-r0 \ +RUN apk --no-cache add ca-certificates && update-ca-certificates \ && rm -rf /var/cache/apk/* WORKDIR /