pub struct DockerfileConfig {
pub base_image: String,
pub commands: Vec<DockerCommand>,
}Fields§
§base_image: String§commands: Vec<DockerCommand>Implementations§
Source§impl DockerfileConfig
impl DockerfileConfig
Sourcepub fn parse<S: AsRef<str>>(content: S) -> Result<DockerfileConfig, DockerError>
pub fn parse<S: AsRef<str>>(content: S) -> Result<DockerfileConfig, DockerError>
Parse a Dockerfile
This handles basic Dockerfile syntax including:
- Line continuations with backslash
- Comments starting with #
- Basic Dockerfile commands like FROM, COPY, etc.
§Example
use docktopus::config::DockerfileConfig;
let content = r#"
FROM ubuntu:latest
COPY . /app
RUN cargo build
"#;
let config = DockerfileConfig::parse(content).unwrap();§Errors
Returns DockerError::DockerfileError if:
- Command syntax is invalid
- Required arguments are missing
- Command is not recognized
Sourcepub fn parse_from_path<P: AsRef<Path>>(
path: P,
) -> Result<DockerfileConfig, DockerError>
pub fn parse_from_path<P: AsRef<Path>>( path: P, ) -> Result<DockerfileConfig, DockerError>
Parse a Dockerfile configuration from a file
§Errors
See DockerfileConfig::parse().
§Examples
use docktopus::config::DockerfileConfig;
let config = DockerfileConfig::parse_from_path("Dockerfile").unwrap();Trait Implementations§
Source§impl Clone for DockerfileConfig
impl Clone for DockerfileConfig
Source§fn clone(&self) -> DockerfileConfig
fn clone(&self) -> DockerfileConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DockerfileConfig
impl Debug for DockerfileConfig
Source§impl<'de> Deserialize<'de> for DockerfileConfig
impl<'de> Deserialize<'de> for DockerfileConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for DockerfileConfig
impl Display for DockerfileConfig
Auto Trait Implementations§
impl Freeze for DockerfileConfig
impl RefUnwindSafe for DockerfileConfig
impl Send for DockerfileConfig
impl Sync for DockerfileConfig
impl Unpin for DockerfileConfig
impl UnsafeUnpin for DockerfileConfig
impl UnwindSafe for DockerfileConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more