diff --git a/build.sh b/build.sh index 0741b21..61fb91d 100644 --- a/build.sh +++ b/build.sh @@ -25,7 +25,7 @@ echo "Host app root: $APP_ROOT" # ── 1. 建表(幂等:CREATE TABLE IF NOT EXISTS 由 json2ddl 产物改造)── cd "$SCRIPT_DIR" -"$PYTHON" - <<'PYEOF' +"$PYTHON" - "$APP_ROOT" <<'PYEOF' import re, sys, os ddl = open('mysql.ddl.sql', encoding='utf-8').read() # json2ddl 产物含 drop table if exists,部署期改为 IF NOT EXISTS 幂等建表 @@ -35,12 +35,12 @@ open('/tmp/pipeline_bidding_ddl.sql', 'w', encoding='utf-8').write(ddl) print('DDL prepared:', ddl.count('CREATE TABLE IF NOT EXISTS'), 'tables') PYEOF -"$PYTHON" - <<'PYEOF' +"$PYTHON" - "$APP_ROOT" <<'PYEOF' import sys, os, subprocess sys.path.insert(0, os.getcwd()) from appPublic.jsonConfig import getConfig from appPublic.aes import aes_decode_b64 -cfg = getConfig('.', {'workdir': '.'}) +cfg = getConfig(sys.argv[1], {'workdir': sys.argv[1]}) kw = cfg.databases['pipeline'].kwargs pwd = aes_decode_b64(cfg.password_key, kw.password) with open('/tmp/pipeline_bidding_ddl.sql', 'rb') as f: @@ -56,7 +56,7 @@ PYEOF # ── 2. 种子数据:appcodes 字典 + pipelines 产线记录(数据源 init/data.json,幂等)── cd "$APP_ROOT" -"$PYTHON" - "$SCRIPT_DIR" <<'PYEOF' +"$PYTHON" - "$SCRIPT_DIR" "$APP_ROOT" <<'PYEOF' import sys, os, json, asyncio CDIR = sys.argv[1] sys.path.insert(0, os.getcwd()) @@ -67,7 +67,7 @@ from appPublic.uniqueID import getID data = json.load(open(os.path.join(CDIR, 'init', 'data.json'))) async def seed(): - config = getConfig('.') + config = getConfig(sys.argv[2], {'workdir': sys.argv[2]}) db = DBPools(config.databases) async with db.sqlorContext('pipeline') as sor: # pipelines 产线主记录(checklist 第 0 步)