1
0

fix: 更新Docker构建脚本

This commit is contained in:
TsMask
2025-05-20 18:47:08 +08:00
parent ac23c3a9f1
commit 46bc90c2e4
8 changed files with 128 additions and 54 deletions

View File

@@ -10,21 +10,25 @@ set -o pipefail
# Load OMC environment variables
. /usr/local/etc/omc/script/omc-env.sh
# Initialize OMC DB
if [ ! -f /usr/local/etc/omc/omc.conf ]; then
bash /usr/local/etc/omc/script/setup.sh -i -m $M_PARAM -c $C_PARAM
fi
# We add the copy from default config in the entrypoint to not break users
# case someone mounts a configuration file in /usr/local/etc/omc/default)
cp -nr "$BASE_DIR"/default/. "$BASE_DIR"
if [[ "$*" = *"/usr/local/etc/omc/script/run.sh"* || "$*" = *"run.sh"* ]]; then
# Ensure OMC is initialized
omcd version
# Start Nginx server
nginx -g "daemon off;"
# Initialize OMC DB
if [ ! -f /usr/local/etc/omc/machine.ini ]; then
bash /usr/local/etc/omc/script/setup.sh -i -m $M_PARAM -c $C_PARAM
fi
echo ""
exec "$@"
# Start Nginx server
nginx -g "daemon off;"
# Parse CLI flags to pass to the 'omc' call
args=("--config" "${BASE_DIR}/omc.conf")
# Add flags specified via the 'CMD_EXTRA_FLAGS' environment variable
read -r -a extra_flags <<< "$CMD_EXTRA_FLAGS"
[[ "${#extra_flags[@]}" -gt 0 ]] && args+=("${extra_flags[@]}")
# Add flags passed to this script
args+=("$@")
omc --version
exec omc "${args[@]}"