Skip to content

Commit

Permalink
feat(container): init project
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Feb 25, 2021
1 parent a228cb3 commit 7f5e365
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 0 deletions.
50 changes: 50 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ members = [
'plugins/coco_struct_analysis',
'plugins/coco_coverage',
'plugins/coco_pipeline',
'plugins/coco_container',
'psa',
]

20 changes: 20 additions & 0 deletions plugins/coco_container/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "coco_container"
version = "0.1.0"
authors = ["Phodal Huang <[email protected]>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
dockerfile-parser = "0.7.1"

[dependencies.core_model]
path = "../../core_model"

[dependencies.plugin_interface]
path = "../../plugin_interface"

[lib]
name = "coco_container"
crate-type = ["cdylib"]
29 changes: 29 additions & 0 deletions plugins/coco_container/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
fn main() {
println!("Hello, world!");
}

#[cfg(test)]
mod tests {
use dockerfile_parser::Dockerfile;

#[test]
pub fn demo() {
let dockerfile = Dockerfile::parse(
r#"
FROM alpine:3.11 as builder
RUN echo "hello world" > /hello-world
FROM scratch
COPY --from=builder /hello-world /hello-world
"#,
)
.unwrap();

for stage in dockerfile.iter_stages() {
println!("stage #{}", stage.index);
for ins in stage.instructions {
println!(" {:?}", ins);
}
}
}
}

0 comments on commit 7f5e365

Please sign in to comment.