Files
doris/docker/runtime/doris-compose/resource/entrypoint.sh
yujun 1ac00ea983 branch-2.1: [feat](doris compose) Copy lastest compose code from master branch (#43464)
Copy lastest code from master branch to support run docker suites
without external doris cluster, enable jvm debug port, ..., etc.
2024-11-08 09:47:19 +08:00

69 lines
2.1 KiB
Bash

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
DIR=$(
cd $(dirname $0)
pwd
)
source $DIR/common.sh
RUN_USER=root
create_host_user() {
if [ -z ${HOST_USER} ]; then
health_log "no specific run user, run as root"
return
fi
id ${HOST_USER}
if [ $? -eq 0 ]; then
health_log "contain user ${HOST_USER}, no create new user"
RUN_USER=${HOST_USER}
return
fi
id ${HOST_UID}
if [ $? -eq 0 ]; then
health_log "contain uid ${HOST_UID}, no create new user"
return
fi
addgroup --gid ${HOST_GID} ${HOST_USER}
if [ $? -eq 0 ]; then
health_log "create group ${HOST_USER} with gid ${HOST_GID} succ"
else
health_log "create group ${HOST_USER} with gid ${HOST_GID} failed"
return
fi
adduser --disabled-password --shell /bin/bash --gecos "" --uid ${HOST_UID} --gid ${HOST_GID} ${HOST_USER}
if [ $? -eq 0 ]; then
health_log "create user ${HOST_USER} with uid ${HOST_UID} succ"
RUN_USER=${HOST_USER}
else
health_log "create user ${HOST_USER} with uid ${HOST_UID} failed"
fi
}
create_host_user
if command -v gosu 2>&1 >/dev/null; then
if [ -f ${LOG_FILE} ]; then
chown ${RUN_USER}:${RUN_USER} ${LOG_FILE}
fi
gosu ${RUN_USER} bash ${DIR}/${1} ${@:2}
else
bash ${DIR}/${1} ${@:2}
fi