This commit is contained in:
@@ -10,7 +10,7 @@ use bollard::{
|
||||
models::{BuildInfo, ContainerCreateBody, NetworkCreateRequest, NetworkDisconnectRequest},
|
||||
query_parameters::{
|
||||
BuildImageOptions, CreateContainerOptions, RemoveContainerOptions, RemoveImageOptions,
|
||||
StartContainerOptions, StopContainerOptions,
|
||||
StartContainerOptions, StopContainerOptions, UploadToContainerOptions,
|
||||
},
|
||||
};
|
||||
use futures_util::StreamExt;
|
||||
@@ -153,6 +153,30 @@ impl ContainerRuntime {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) async fn upload_directory(
|
||||
&self,
|
||||
container: &str,
|
||||
destination: &str,
|
||||
directory: &Path,
|
||||
) -> Result<(), ContainerError> {
|
||||
let options = UploadToContainerOptions {
|
||||
path: String::from(destination),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
self.request(
|
||||
"upload workspace",
|
||||
self.docker.upload_to_container(
|
||||
container,
|
||||
Some(options),
|
||||
body_try_stream(tar_directory_stream(directory)),
|
||||
),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) async fn start_container(&self, name: &str) -> Result<(), ContainerError> {
|
||||
self.request(
|
||||
"start container",
|
||||
|
||||
Reference in New Issue
Block a user