source ../environment.sh
 

if docker ps -a | grep -q ${OIDC_ADMIN_NAME}; then
    echo "停止并删除已存在的 OIDC_ADMIN_NAME 容器..."
    docker stop ${OIDC_ADMIN_NAME} >/dev/null 2>&1
    docker rm ${OIDC_ADMIN_NAME} >/dev/null 2>&1
fi


docker run --pull always -d \
--name ${OIDC_ADMIN_NAME} \
--network ${NETWORK} \
--env SPRING_CLOUD_CONSUL_HOST=${CONSUL_NAME} \
--env SPRING_CLOUD_CONSUL_PORT=8500 \
--env SPRING_CLOUD_CONSUL_DISCOVERY_HOSTNAME=${OIDC_ADMIN_NAME} \
--env XXL_JOB_ADMIN_ADDRESSES=http://${XXLJOB_NAME}:8080/xxl-job-admin \
--env XXL_JOB_ACCESSTOKEN=${XXLJOB_ACCESS_TOKEN} \
--env XXL_ENABLE=false \
--env SPRING_REDIS_HOST=${REDIS_NAME} \
--env SPRING_REDIS_PORT=6379 \
--env SPRING_DATASOURCE_URL="jdbc:mysql://${MYSQL_NAME}:3306/tuoheng_oidc?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false" \
--env SPRING_DATASOURCE_USERNAME=root \
--env SPRING_DATASOURCE_PASSWORD=${MYSQL_ROOT_PASSWORD} \
--env TZ=Asia/Shanghai \
--env SPRING_KAFKA_BOOTSTRAP_SERVERS=${KAFKA_NAME}:${KAFKA_PORT} \
--mount type=bind,source=/etc/localtime,target=/etc/localtime,readonly \
--memory ${OIDC_ADMIN_MEMORY} \
--restart unless-stopped \
${OIDC_ADMIN_IMAGE}