use non root user for building image (#2449)

Signed-off-by: Jeff <zw0948@gmail.com>
This commit is contained in:
zryfish
2020-07-16 18:52:51 +08:00
committed by GitHub
parent fcea347780
commit a1767d4245
2 changed files with 18 additions and 4 deletions

View File

@@ -1,7 +1,14 @@
# Copyright 2018 The KubeSphere Authors. All rights reserved.
# Copyright 2020 The KubeSphere Authors. All rights reserved.
# Use of this source code is governed by an Apache license
# that can be found in the LICENSE file.
FROM alpine:3.9
RUN apk add --update ca-certificates && update-ca-certificates
COPY /bin/cmd/ks-apiserver /usr/local/bin/
RUN apk add --update ca-certificates && \
update-ca-certificates && \
adduser -D -g kubesphere -u 1002 kubesphere && \
chown -R kubesphere:kubesphere /usr/local/bin/ks-apiserver
USER kubesphere
CMD ["sh"]

View File

@@ -1,7 +1,14 @@
# Copyright 2018 The KubeSphere Authors. All rights reserved.
# Copyright 2020 The KubeSphere Authors. All rights reserved.
# Use of this source code is governed by an Apache license
# that can be found in the LICENSE file.
FROM alpine:3.7
RUN apk add --update ca-certificates && update-ca-certificates
COPY /bin/cmd/controller-manager /usr/local/bin/
RUN apk add --update ca-certificates && \
update-ca-certificates && \
adduser -D -g kubesphere -u 1002 kubesphere && \
chown -R kubesphere:kubesphere /usr/local/bin/controller-manager
USER kubesphere
CMD controller-manager