diff --git a/docker-compose.dev-sx-native.yml b/docker-compose.dev-sx-native.yml new file mode 100644 index 00000000..7e5b4959 --- /dev/null +++ b/docker-compose.dev-sx-native.yml @@ -0,0 +1,14 @@ +# Native OCaml HTTP server for sx_docs — no Python, no Quart +# Overrides dev-sx.yml entrypoint to use sx_server --http +# +# Usage: +# docker compose -p sx-dev -f docker-compose.dev-sx.yml -f docker-compose.dev-sx-native.yml up + +services: + sx_docs: + entrypoint: ["/app/bin/sx_server", "--http", "8000"] + environment: + SX_PROJECT_DIR: /app + SX_SPEC_DIR: /app/spec + SX_LIB_DIR: /app/lib + SX_WEB_DIR: /app/web diff --git a/hosts/ocaml/bin/sx_server.ml b/hosts/ocaml/bin/sx_server.ml index d3bdcfe7..5c5c0fe6 100644 --- a/hosts/ocaml/bin/sx_server.ml +++ b/hosts/ocaml/bin/sx_server.ml @@ -1695,8 +1695,14 @@ let http_mode port = project_dir ^ "/lib" in let web_base = try Sys.getenv "SX_WEB_DIR" with Not_found -> project_dir ^ "/web" in - let shared_sx = project_dir ^ "/shared/sx/templates" in - let sx_sx = project_dir ^ "/sx/sx" in + let shared_sx = try Sys.getenv "SX_SHARED_DIR" with Not_found -> + project_dir ^ "/shared/sx/templates" in + let sx_sx = try Sys.getenv "SX_COMPONENTS_DIR" with Not_found -> + (* Docker: /app/sx, dev: /project/sx/sx *) + let docker_path = project_dir ^ "/sx" in + let dev_path = project_dir ^ "/sx/sx" in + if Sys.file_exists (docker_path ^ "/page-functions.sx") then docker_path + else dev_path in let t0 = Unix.gettimeofday () in (* Core spec + adapters. Skip: primitives.sx (declarative metadata — all prims native in OCaml),