decomposer: generate files for Create a production-suitable Dockerfile and minimal Docker Compose configuration for packaging and running the completed FastAPI endpoint monitoring service.
This commit is contained in:
31
scripts/integration.sh
Normal file
31
scripts/integration.sh
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
ROOT="$(mktemp -d)"
|
||||||
|
trap 'docker compose -f "$ROOT/compose.yaml" down --volumes >/dev/null 2>&1 || true; rm -rf "$ROOT"' EXIT
|
||||||
|
mkdir -p "$ROOT/app"
|
||||||
|
cat > "$ROOT/app/main.py" <<'PY'
|
||||||
|
from fastapi import FastAPI
|
||||||
|
app = FastAPI()
|
||||||
|
@app.get("/health")
|
||||||
|
def health(): return {"status": "ok"}
|
||||||
|
PY
|
||||||
|
# Complete, exact dependency closure; --no-deps prevents unpinned resolution.
|
||||||
|
cat > "$ROOT/requirements.lock" <<'REQ'
|
||||||
|
annotated-types==0.7.0
|
||||||
|
anyio==4.7.0
|
||||||
|
click==8.1.8
|
||||||
|
fastapi==0.115.6
|
||||||
|
h11==0.14.0
|
||||||
|
idna==3.10
|
||||||
|
pydantic==2.10.4
|
||||||
|
pydantic-core==2.27.2
|
||||||
|
sniffio==1.3.1
|
||||||
|
starlette==0.41.3
|
||||||
|
typing-extensions==4.12.2
|
||||||
|
uvicorn==0.34.0
|
||||||
|
REQ
|
||||||
|
cat > "$ROOT/input.json" <<'JSON'
|
||||||
|
{"service_specification":{"container":{"startup_module":"app.main:app","port":8000,"health_endpoint":"/health"}},"target_management_implementation":{},"endpoint_check_implementation":{},"current_status_implementation":{}}
|
||||||
|
JSON
|
||||||
|
containerize-fastapi --input "$ROOT/input.json" --service-dir "$ROOT" --output "$ROOT/output.json" --verify-docker
|
||||||
|
python -c 'import json,sys; d=json.load(open(sys.argv[1])); assert d["container_artifacts"]["docker_verification"]["passed"]' "$ROOT/output.json"
|
||||||
Reference in New Issue
Block a user