Skip to content

Commit 5f6cd97

Browse files
committed
docs: sync imports
1 parent e370de3 commit 5f6cd97

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

docs/features/building_images.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,12 @@ let image = GenericBuildableImage::new("my-app", "latest")
158158

159159
## Synchronous API
160160

161-
For non-async tests, use the [`SyncRunner`](https://docs.rs/testcontainers/latest/testcontainers/runners/trait.SyncRunner.html) trait (requires the `blocking` feature):
161+
For non-async tests, use the [`SyncBuilder`](https://docs.rs/testcontainers/latest/testcontainers/runners/trait.SyncBuilder.html) trait to build images and [`SyncRunner`](https://docs.rs/testcontainers/latest/testcontainers/runners/trait.SyncRunner.html) to run containers (requires the `blocking` feature):
162162

163163
```rust
164164
use testcontainers::{
165-
runners::SyncRunner,
165+
core::BuildImageOptions,
166+
runners::{SyncBuilder, SyncRunner},
166167
GenericBuildableImage,
167168
};
168169

@@ -175,6 +176,20 @@ fn test_sync_build() -> Result<(), Box<dyn std::error::Error>> {
175176
let container = image.start()?;
176177
Ok(())
177178
}
179+
180+
#[test]
181+
fn test_sync_build_with_options() -> Result<(), Box<dyn std::error::Error>> {
182+
let image = GenericBuildableImage::new("my-app", "latest")
183+
.with_dockerfile_string("FROM alpine:latest\nARG VERSION")
184+
.build_image_with(
185+
BuildImageOptions::new()
186+
.with_skip_if_exists(true)
187+
.with_build_arg("VERSION", "1.0.0")
188+
)?;
189+
190+
let container = image.start()?;
191+
Ok(())
192+
}
178193
```
179194

180195
## Best Practices

0 commit comments

Comments
 (0)