Skip to main content

systemprompt_cloud/deploy/
mod.rs

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