Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update alpine base image #1166

Merged
merged 1 commit into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Build the manager and daemon binaries
FROM golang:1.18 as builder
ARG BASE_IMAGE=alpine
ARG BASE_IMAGE_VERION=3.17
FROM golang:1.18-alpine3.17 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand All @@ -17,12 +19,12 @@ COPY vendor/ vendor/
RUN CGO_ENABLED=0 GO111MODULE=on go build -mod=vendor -a -o manager main.go \
&& CGO_ENABLED=0 GO111MODULE=on go build -mod=vendor -a -o daemon ./cmd/daemon/main.go

# Use Ubuntu 20.04 LTS as base image to package the binaries
FROM ubuntu:focal
# This is required by daemon connnecting with CRI
RUN ln -s /usr/bin/* /usr/sbin/ && apt-get update -y \
&& apt-get install --no-install-recommends -y ca-certificates \
&& apt-get clean && rm -rf /var/log/*log /var/lib/apt/lists/* /var/log/apt/* /var/lib/dpkg/*-old /var/cache/debconf/*-old
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 \
&& rm -rf /var/cache/apk/*

WORKDIR /
COPY --from=builder /workspace/manager .
Expand Down
20 changes: 12 additions & 8 deletions Dockerfile_multiarch
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Build the manager and daemon binaries
FROM --platform=$BUILDPLATFORM golang:1.18 as builder
ARG BASE_IMAGE=alpine
ARG BASE_IMAGE_VERION=3.17
FROM --platform=$BUILDPLATFORM golang:1.18-alpine3.17 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand All @@ -14,16 +16,18 @@ COPY pkg/ pkg/
COPY vendor/ vendor/

# Build
ARG TARGETOS TARGETARCH
ARG TARGETOS
ARG TARGETARCH
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=0 GO111MODULE=on go build -mod=vendor -a -o manager main.go \
&& GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=0 GO111MODULE=on go build -mod=vendor -a -o daemon ./cmd/daemon/main.go

# Use Ubuntu 20.04 LTS as base image to package the binaries
FROM --platform=$TARGETPLATFORM ubuntu:focal
# This is required by daemon connnecting with CRI
RUN ln -s /usr/bin/* /usr/sbin/ && apt-get update -y \
&& apt-get install --no-install-recommends -y ca-certificates \
&& apt-get clean && rm -rf /var/log/*log /var/lib/apt/lists/* /var/log/apt/* /var/lib/dpkg/*-old /var/cache/debconf/*-old

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 \
&& rm -rf /var/cache/apk/*

WORKDIR /
COPY --from=builder /workspace/manager .
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Image URL to use all building/pushing image targets
IMG ?= openkruise/kruise-manager:test
# Platforms to build the image for
PLATFORMS ?= linux/amd64,linux/arm64,linux/arm,linux/ppc64le
PLATFORMS ?= linux/amd64,linux/arm64,linux/ppc64le
CRD_OPTIONS ?= "crd:crdVersions=v1"

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
Expand Down