Skip to content

Commit

Permalink
Trimming the kruise image to remove some non-essential commands (#1397)
Browse files Browse the repository at this point in the history
* wrokflow docker image ci

Signed-off-by: liheng.zms <liheng.zms@alibaba-inc.com>

* Trimming the kruise image to remove some non-essential commands

Signed-off-by: liheng.zms <liheng.zms@alibaba-inc.com>

---------

Signed-off-by: liheng.zms <liheng.zms@alibaba-inc.com>
  • Loading branch information
zmberg committed Sep 1, 2023
1 parent e5197de commit a477df8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion 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
Expand Down
19 changes: 16 additions & 3 deletions 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
Expand All @@ -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 .
Expand Down

0 comments on commit a477df8

Please sign in to comment.