[KYUUBI #3719] [K8S] Create kyuubi user dir while building kyuubi docker image

### _Why are the changes needed?_

Create kyuubi user directory  while building kyuubi docker image to avoid the issue that kyuubi user do not have a default user directory or do not have permission to create a default user.

Also improved, change `KYUUBI_HOME` owner to kyuubi user.

### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible

- [x] Add screenshots for manual tests if appropriate

- [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request

- [X] build docker image and run in kubernetes

Closes #3719 from zwangsheng/imporve/kyuubi-dockerfile-kyuubi-user-file.

Closes #3719

45c1cb8a [zwangsheng] fix
059dbd53 [zwangsheng] init

Authored-by: zwangsheng <2213335496@qq.com>
Signed-off-by: hongdongdong <hongdd@apache.org>
This commit is contained in:
zwangsheng 2022-10-31 16:49:56 +08:00 committed by hongdongdong
parent 96570a45e2
commit 292457edf8

View File

@ -51,10 +51,8 @@ RUN set -ex && \
sed -i 's/http:\/\/deb.\(.*\)/https:\/\/deb.\1/g' /etc/apt/sources.list && \
apt-get update && \
apt install -y bash tini libc6 libpam-modules krb5-user libnss3 procps && \
useradd -u ${kyuubi_uid} -g root kyuubi && \
useradd -u ${kyuubi_uid} -g root kyuubi -d /home/kyuubi -m && \
mkdir -p ${KYUUBI_HOME} ${KYUUBI_LOG_DIR} ${KYUUBI_PID_DIR} ${KYUUBI_WORK_DIR_ROOT} && \
chmod ug+rw -R ${KYUUBI_HOME} && \
chmod a+rwx -R ${KYUUBI_WORK_DIR_ROOT} && \
rm -rf /var/cache/apt/*
COPY bin ${KYUUBI_HOME}/bin
@ -63,6 +61,9 @@ COPY beeline-jars ${KYUUBI_HOME}/beeline-jars
COPY externals/engines/spark ${KYUUBI_HOME}/externals/engines/spark
WORKDIR ${KYUUBI_HOME}
RUN chown -R kyuubi:root ${KYUUBI_HOME} && \
chmod ug+rw -R ${KYUUBI_HOME} && \
chmod a+rwx -R ${KYUUBI_WORK_DIR_ROOT}
CMD [ "./bin/kyuubi", "run" ]