diff --git a/build/ks-apiserver/Dockerfile b/build/ks-apiserver/Dockerfile index 7dff71086..87eae367a 100644 --- a/build/ks-apiserver/Dockerfile +++ b/build/ks-apiserver/Dockerfile @@ -1,16 +1,20 @@ # 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 +FROM alpine:3.11 +ENV USER=kubesphere +ENV UID=1002 +# docker group +ENV GID=998 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 +RUN apk add --no-cache ca-certificates && \ + addgroup --gid "$GID" "$USER" && \ + adduser -D -g "" --ingroup "$USER" -u "$UID" "$USER" && \ + chown -R kubesphere:"$GID" /usr/local/bin/ks-apiserver EXPOSE 9090 USER kubesphere -CMD ["sh"] +CMD ["sh"] \ No newline at end of file diff --git a/build/ks-controller-manager/Dockerfile b/build/ks-controller-manager/Dockerfile index a008492ee..1728a099c 100644 --- a/build/ks-controller-manager/Dockerfile +++ b/build/ks-controller-manager/Dockerfile @@ -1,17 +1,20 @@ # 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 +FROM alpine:3.11 +ENV USER=kubesphere +ENV UID=1002 +# docker group +ENV GID=998 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 +RUN apk add --no-cache ca-certificates && \ + addgroup --gid "$GID" "$USER" && \ + adduser -D -g "" --ingroup "$USER" -u "$UID" "$USER" && \ + chown -R kubesphere:"$GID" /usr/local/bin/controller-manager EXPOSE 8443 8080 -CMD controller-manager +USER kubesphere +CMD ["sh"] \ No newline at end of file