Skip to main content

systemprompt_cloud/deploy/
mod.rs

1//! Deployment building blocks: Dockerfile rendering and validation, and the
2//! per-provider deploy seam.
3//!
4//! [`DockerfileBuilder`] renders the runtime-image Dockerfile from the
5//! discovered extensions and services config; the validation helpers assert a
6//! profile's Dockerfile copies the expected MCP binaries and carries no stale
7//! ones. [`find_services_config`] locates the project's services config, the
8//! shared input to both; writing the rendered Dockerfile is the caller's
9//! concern. [`provider`] holds [`provider::DeployProvider`] and its managed
10//! cloud and `GitOps` implementations.
11//!
12//! Copyright (c) systemprompt.io — Business Source License 1.1.
13//! See <https://systemprompt.io> for licensing details.
14
15mod dockerfile;
16pub mod provider;
17mod validation;
18
19pub use dockerfile::DockerfileBuilder;
20pub use validation::{
21    get_required_mcp_copy_lines, validate_dockerfile_has_mcp_binaries,
22    validate_dockerfile_has_no_stale_binaries, validate_profile_dockerfile,
23};
24
25use std::path::{Path, PathBuf};
26
27use crate::error::{CloudError, CloudResult};
28
29pub fn find_services_config(root: &Path) -> CloudResult<PathBuf> {
30    let path = root.join("services/config/config.yaml");
31    if path.exists() {
32        return Ok(path);
33    }
34    Err(CloudError::deploy(
35        "Services config not found.\n\nExpected at: services/config/config.yaml",
36    ))
37}
38
39#[must_use]
40pub fn generate_dockerfile_content(project_root: &Path) -> String {
41    DockerfileBuilder::new(project_root).build()
42}