Skip to content

Commit

Permalink
minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
lffg committed Jun 18, 2024
1 parent 58625d8 commit 65d3f67
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions worker/src/runner/container_rt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ impl ContainerRuntime {
let create_response = self.create_container(spec, port, name.clone()).await?;

self.run_container(create_response).await?;

Ok(())
}

Expand All @@ -77,7 +78,7 @@ impl ContainerRuntime {
port: u16,
name: String,
) -> eyre::Result<ContainerCreateResponse> {
let config = self.create_container_config(spec.clone(), port);
let config = Self::create_container_config(spec.clone(), port);

let options = Some(CreateContainerOptions {
name,
Expand Down Expand Up @@ -114,16 +115,14 @@ impl ContainerRuntime {
}
}

#[allow(clippy::unused_self)]
#[allow(clippy::zero_sized_map_values)]
fn create_container_config(&self, spec: InstanceSpec, port: u16) -> Config<String> {
fn create_container_config(spec: InstanceSpec, port: u16) -> Config<String> {
Config {
image: Some(spec.image.0),
exposed_ports: Some({
let mut map = HashMap::new();
map.insert(format!("{port}/tcp"), HashMap::default());
map
}),
exposed_ports: Some(HashMap::from([(
format!("{port}/tcp"),
#[allow(clippy::zero_sized_map_values)]
HashMap::default(),
)])),
env: Some(vec![format!("PORT={port}")]),
host_config: Some(HostConfig {
cpu_shares: Some(spec.resource_config.cpu_shares),
Expand Down

0 comments on commit 65d3f67

Please sign in to comment.