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
10mod dockerfile;
11mod validation;
12
13pub use dockerfile::DockerfileBuilder;
14pub use validation::{
15    get_required_mcp_copy_lines, validate_dockerfile_has_mcp_binaries,
16    validate_dockerfile_has_no_stale_binaries, validate_profile_dockerfile,
17};
18
19use std::path::{Path, PathBuf};
20
21use crate::error::{CloudError, CloudResult};
22
23pub fn find_services_config(root: &Path) -> CloudResult<PathBuf> {
24    let path = root.join("services/config/config.yaml");
25    if path.exists() {
26        return Ok(path);
27    }
28    Err(CloudError::deploy(
29        "Services config not found.\n\nExpected at: services/config/config.yaml",
30    ))
31}
32
33#[must_use]
34pub fn generate_dockerfile_content(project_root: &Path) -> String {
35    DockerfileBuilder::new(project_root).build()
36}