From e721449c46b8a9e1a681866db2fc96e940be39ab Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 9 Feb 2022 15:25:59 +0800 Subject: [PATCH] [Backport release-1.2] Feat: the golang version upgrade to 1.7 (#3213) * Feat: the golang version upgrade to 1.7 Signed-off-by: barnettZQG (cherry picked from commit f7e75a18a0574a39cdac1c3a8ac92d0b1174e639) * Feat: install expat lib Signed-off-by: barnettZQG (cherry picked from commit e641c39509772059e4fe3fb8a8326b559d86d123) Co-authored-by: barnettZQG --- Dockerfile | 8 ++++---- Dockerfile.apiserver | 8 ++++---- Dockerfile.e2e | 13 +++++++------ 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index e944c0b84..4a05932fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ -ARG BASE_IMAGE="alpine:latest" +ARG BASE_IMAGE # Build the manager binary -FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.16-alpine as builder +FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.17-alpine as builder WORKDIR /workspace # Copy the Go Modules manifests @@ -34,9 +34,9 @@ RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} \ # You can replace distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details # Overwrite `BASE_IMAGE` by passing `--build-arg=BASE_IMAGE=gcr.io/distroless/static:nonroot` -FROM ${BASE_IMAGE:-alpine:latest} +FROM ${BASE_IMAGE:-alpine:3.15} # This is required by daemon connnecting with cri -RUN apk add --no-cache ca-certificates bash +RUN apk add --no-cache ca-certificates bash expat WORKDIR / diff --git a/Dockerfile.apiserver b/Dockerfile.apiserver index 4b39b7130..f9544b087 100644 --- a/Dockerfile.apiserver +++ b/Dockerfile.apiserver @@ -1,6 +1,6 @@ -ARG BASE_IMAGE="alpine:latest" +ARG BASE_IMAGE # Build the manager binary -FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.16-alpine as builder +FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.17-alpine as builder ARG GOPROXY ENV GOPROXY=${GOPROXY:-https://goproxy.cn} WORKDIR /workspace @@ -32,9 +32,9 @@ RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} \ # Refer to https://github.com/GoogleContainerTools/distroless for more details # Overwrite `BASE_IMAGE` by passing `--build-arg=BASE_IMAGE=gcr.io/distroless/static:nonroot` -FROM ${BASE_IMAGE:-alpine:latest} +FROM ${BASE_IMAGE:-alpine:3.15} # This is required by daemon connnecting with cri -RUN apk add --no-cache ca-certificates bash +RUN apk add --no-cache ca-certificates bash expat WORKDIR / diff --git a/Dockerfile.e2e b/Dockerfile.e2e index 2d532b729..5b8893767 100644 --- a/Dockerfile.e2e +++ b/Dockerfile.e2e @@ -1,5 +1,6 @@ +ARG BASE_IMAGE # Build the manager binary -FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.16-alpine as builder +FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.17-alpine as builder WORKDIR /workspace # Copy the Go Modules manifests @@ -24,8 +25,8 @@ ARG VERSION ARG GITVERSION RUN apk add gcc musl-dev libc-dev ;\ - GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} \ - go test -c -o manager-${TARGETARCH} -cover -covermode=atomic -coverpkg ./... . + GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} \ + go test -c -o manager-${TARGETARCH} -cover -covermode=atomic -coverpkg ./... . RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} \ go build -a -ldflags "-s -w -X github.com/oam-dev/kubevela/version.VelaVersion=${VERSION:-undefined} -X github.com/oam-dev/kubevela/version.GitRevision=${GITVERSION:-undefined}" \ @@ -35,10 +36,10 @@ RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} \ # You can replace distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details # Overwrite `BASE_IMAGE` by passing `--build-arg=BASE_IMAGE=gcr.io/distroless/static:nonroot` -ARG BASE_IMAGE -FROM ${BASE_IMAGE:-alpine:latest} + +FROM ${BASE_IMAGE:-alpine:3.15} # This is required by daemon connnecting with cri -RUN apk add --no-cache ca-certificates bash +RUN apk add --no-cache ca-certificates bash expat WORKDIR /