Skip to content
use std::error::Error;

const GUIDANCE: &str = r#"# Dockerfile guidance

When adding a `Dockerfile`, place it in the project root and define the image's
registry name with a Docker `LABEL`:

```dockerfile
LABEL remote="owner/image"
```

Replace `owner/image` with this project's actual image name. The release command
reads this label and uses it to build and push both the versioned image and the
`latest` tag, so the name must match the image's registry repository.

Before choosing the value, search the repository for how the remote image is
named (for example, in existing Docker configuration, CI workflows, manifests,
documentation, and Git or registry references). Reuse the established name when
you can identify it. Do not guess: if the repository does not make the name
clear, ask the user what the remote image name should be, then use that answer in
the label.
"#;

pub fn run() -> Result<(), Box<dyn Error>> {
    print!("{GUIDANCE}");
    Ok(())
}

#[cfg(test)]
mod tests {
    use super::GUIDANCE;

    #[test]
    fn guidance_documents_remote_label_and_image_name_discovery() {
        assert!(GUIDANCE.contains("LABEL remote=\"owner/image\""));
        assert!(GUIDANCE.contains("search the repository"));
        assert!(GUIDANCE.contains("ask the user"));
    }
}