diff --git a/Dockerfile b/Dockerfile index 04ae2035b8..2482893db0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # Build the manager and daemon binaries ARG BASE_IMAGE=alpine ARG BASE_IMAGE_VERSION=3.17 -FROM golang:1.18-alpine3.17 as builder +FROM golang:1.19-alpine3.17 as builder WORKDIR /workspace # Copy the Go Modules manifests diff --git a/Dockerfile_multiarch b/Dockerfile_multiarch index c9b540a896..7fef55861d 100644 --- a/Dockerfile_multiarch +++ b/Dockerfile_multiarch @@ -1,7 +1,7 @@ # Build the manager and daemon binaries ARG BASE_IMAGE=alpine ARG BASE_IMAGE_VERSION=3.17 -FROM --platform=$BUILDPLATFORM golang:1.18-alpine3.17 as builder +FROM --platform=$BUILDPLATFORM golang:1.19-alpine3.17 as builder WORKDIR /workspace # Copy the Go Modules manifests @@ -26,8 +26,21 @@ ARG BASE_IMAGE ARG BASE_IMAGE_VERSION FROM ${BASE_IMAGE}:${BASE_IMAGE_VERSION} -RUN apk add --no-cache ca-certificates bash expat \ - && rm -rf /var/cache/apk/* +RUN set -eux; \ + apk --no-cache --update upgrade && \ + apk --no-cache add ca-certificates && \ + apk --no-cache add tzdata && \ + rm -rf /var/cache/apk/* && \ + update-ca-certificates && \ + echo "only include root and nobody user" && \ + echo -e "root:x:0:0:root:/root:/bin/ash\nnobody:x:65534:65534:nobody:/:/sbin/nologin" | tee /etc/passwd && \ + echo -e "root:x:0:root\nnobody:x:65534:" | tee /etc/group && \ + rm -rf /usr/local/sbin/* && \ + rm -rf /usr/local/bin/* && \ + rm -rf /usr/sbin/* && \ + rm -rf /usr/bin/* && \ + rm -rf /sbin/* && \ + rm -rf /bin/* WORKDIR / COPY --from=builder /workspace/manager .