mirror of
https://codeberg.org/icewind/haze.git
synced 2026-06-04 01:24:09 +02:00
update bollard
This commit is contained in:
parent
f569ca17e2
commit
df38f16f10
23 changed files with 410 additions and 502 deletions
26
src/php.rs
26
src/php.rs
|
|
@ -4,9 +4,9 @@ use crate::image::pull_image;
|
|||
use crate::network::ensure_network_exists;
|
||||
use crate::service::Service;
|
||||
use crate::service::ServiceTrait;
|
||||
use bollard::container::{Config, CreateContainerOptions, NetworkingConfig};
|
||||
use bollard::config::{ContainerCreateBody, NetworkConnectRequest, NetworkingConfig};
|
||||
use bollard::models::{EndpointSettings, HostConfig};
|
||||
use bollard::network::ConnectNetworkOptions;
|
||||
use bollard::query_parameters::CreateContainerOptions;
|
||||
use bollard::Docker;
|
||||
use itertools::Itertools;
|
||||
use maplit::hashmap;
|
||||
|
|
@ -169,7 +169,7 @@ impl PhpVersion {
|
|||
ensure_network_exists(docker, "haze").await?;
|
||||
pull_image(docker, self.image()).await?;
|
||||
let options = Some(CreateContainerOptions {
|
||||
name: id.to_string(),
|
||||
name: Some(id.to_string()),
|
||||
..CreateContainerOptions::default()
|
||||
});
|
||||
let clean_id = id.strip_prefix("haze-").unwrap_or(id);
|
||||
|
|
@ -204,7 +204,7 @@ impl PhpVersion {
|
|||
labels.insert("haze-version".to_string(), version.to_string());
|
||||
}
|
||||
|
||||
let config = Config {
|
||||
let config = ContainerCreateBody {
|
||||
image: Some(self.image().to_string()),
|
||||
env: Some(env),
|
||||
host_config: Some(HostConfig {
|
||||
|
|
@ -216,12 +216,12 @@ impl PhpVersion {
|
|||
..Default::default()
|
||||
}),
|
||||
networking_config: Some(NetworkingConfig {
|
||||
endpoints_config: hashmap! {
|
||||
endpoints_config: Some(hashmap! {
|
||||
network.to_string() => EndpointSettings {
|
||||
aliases: Some(vec!["cloud".to_string()]),
|
||||
..Default::default()
|
||||
}
|
||||
},
|
||||
}),
|
||||
}),
|
||||
labels: Some(labels),
|
||||
..Default::default()
|
||||
|
|
@ -233,11 +233,7 @@ impl PhpVersion {
|
|||
.into_diagnostic()?
|
||||
.id;
|
||||
|
||||
if let Err(e) = docker
|
||||
.start_container::<String>(&id, None)
|
||||
.await
|
||||
.into_diagnostic()
|
||||
{
|
||||
if let Err(e) = docker.start_container(&id, None).await.into_diagnostic() {
|
||||
docker.remove_container(&id, None).await.ok();
|
||||
return Err(e);
|
||||
}
|
||||
|
|
@ -245,12 +241,12 @@ impl PhpVersion {
|
|||
if let Err(e) = docker
|
||||
.connect_network(
|
||||
"haze",
|
||||
ConnectNetworkOptions {
|
||||
container: id.as_str(),
|
||||
endpoint_config: EndpointSettings {
|
||||
NetworkConnectRequest {
|
||||
container: id.to_string(),
|
||||
endpoint_config: Some(EndpointSettings {
|
||||
aliases: Some(vec![id.to_string()]),
|
||||
..Default::default()
|
||||
},
|
||||
}),
|
||||
},
|
||||
)
|
||||
.await
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue