Inject app variables into deployments
This commit is contained in:
@@ -11,11 +11,13 @@ cat > "$COMPOSE_FILE" <<'EOF_COMPOSE'
|
||||
services:
|
||||
EOF_COMPOSE
|
||||
|
||||
python3 - "$CATALOG_FILE" "$COMPOSE_FILE" <<'PY'
|
||||
python3 - "$CATALOG_FILE" "$COMPOSE_FILE" "$APPFACTORY_DIR" <<'PY'
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
catalog_file = sys.argv[1]
|
||||
compose_file = sys.argv[2]
|
||||
appfactory_dir = sys.argv[3]
|
||||
|
||||
apps = []
|
||||
current = None
|
||||
@@ -41,11 +43,14 @@ with open(compose_file, "a", encoding="utf-8") as f:
|
||||
app_id = app["id"]
|
||||
memory = app.get("memory", "")
|
||||
cpus = app.get("cpus", "")
|
||||
env_file = f"{appfactory_dir}/data/apps/{app_id}/.env"
|
||||
|
||||
f.write(f" {app_id}:\n")
|
||||
f.write(f" image: {app_id}:latest\n")
|
||||
f.write(f" container_name: {app_id}\n")
|
||||
f.write(" restart: unless-stopped\n")
|
||||
f.write(" env_file:\n")
|
||||
f.write(f" - {env_file}\n")
|
||||
|
||||
if memory:
|
||||
f.write(f" mem_limit: {memory}\n")
|
||||
|
||||
Reference in New Issue
Block a user