Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions catalog/tempo/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use serde::Deserialize;
use spec::{Arg, Babel, ComputeResource, Deployment, DeploymentExtension, Manifest, Pod, Spec, Volume};
use spec::{
Arg, Babel, ComputeResource, Deployment, DeploymentExtension, Manifest, Platform, Pod, Spec,
Volume,
};

#[derive(Default, Clone)]
pub enum Chains {
Expand Down Expand Up @@ -37,7 +40,7 @@ impl ComputeResource for Tempo {

fn spec(&self, _chain: Chains) -> eyre::Result<Pod> {
let node = Spec::builder()
.image("ghcr.io/tempo-xyz/tempo")
.image("ghcr.io/tempoxyz/tempo")
.tag("1.0.1")
.volume(Volume {
name: "data".to_string(),
Expand Down Expand Up @@ -77,6 +80,7 @@ impl ComputeResource for Tempo {
preferred: 9000,
},
)
.platform(Platform::LinuxAmd64)
.with_babel(Babel::new(
"ethereum",
Arg::Ref {
Expand Down
4 changes: 4 additions & 0 deletions crates/runtime-docker-compose/src/compose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ pub(crate) struct DockerComposeService {
#[serde(default)]
#[serde(skip_serializing_if = "BTreeMap::is_empty")]
pub depends_on: BTreeMap<String, DependsOn>,

#[serde(default)]
#[serde(skip_serializing_if = "Option::is_none")]
pub platform: Option<String>,
}

#[derive(Default, Debug)]
Expand Down
12 changes: 11 additions & 1 deletion crates/runtime-docker-compose/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use bollard::Docker;
use bollard::query_parameters::CreateImageOptions;
use futures_util::future::join_all;
use futures_util::stream::StreamExt;
use spec::{File, Manifest};
use spec::{File, Manifest, Platform};
use std::collections::{BTreeMap, HashMap, HashSet};
use std::net::TcpListener;
use std::process::{Command, Stdio};
Expand Down Expand Up @@ -360,6 +360,15 @@ impl DockerRuntime {
labels.insert("metrics".to_string(), format!("{}", metrics_port.port));
}

let platform = if let Some(platform) = spec.platform {
let str = match platform {
Platform::LinuxAmd64 => "linux/amd64".to_string(),
};
Some(str)
} else {
None
};

let service = DockerComposeService {
command,
entrypoint: spec.entrypoint.clone(),
Expand All @@ -370,6 +379,7 @@ impl DockerRuntime {
volumes: service_volumes,
networks: vec!["test".to_string()],
depends_on: init_services,
platform,
};

let service_name = format!("{}-{}", pod_name, spec_name);
Expand Down
13 changes: 13 additions & 0 deletions crates/spec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ pub struct Spec {
pub artifacts: Vec<Artifacts>,
pub ports: Vec<Port>,
pub volumes: Vec<Volume>,
pub platform: Option<Platform>,
pub extensions: HashMap<String, serde_json::Value>,
}

Expand All @@ -237,6 +238,7 @@ pub struct SpecBuilder {
ports: Vec<Port>,
volumes: Vec<Volume>,
extensions: HashMap<String, serde_json::Value>,
platform: Option<Platform>,
}

impl Spec {
Expand All @@ -245,6 +247,11 @@ impl Spec {
}
}

#[derive(Debug, Copy, Clone, Deserialize, Serialize)]
pub enum Platform {
LinuxAmd64,
}

impl SpecBuilder {
pub fn image<S: Into<String>>(mut self, image: S) -> Self {
self.image = Some(image.into());
Expand Down Expand Up @@ -327,6 +334,11 @@ impl SpecBuilder {
self
}

pub fn platform(mut self, platform: Platform) -> Self {
self.platform = Some(platform);
self
}

pub fn get_extension<R: serde::de::DeserializeOwned>(
&self,
name: String,
Expand Down Expand Up @@ -360,6 +372,7 @@ impl SpecBuilder {
ports: ports,
volumes: self.volumes,
extensions: self.extensions,
platform: self.platform,
}
}
}
Expand Down
Loading