Skip to main content

ContainerSpec

Struct ContainerSpec 

Source
#[non_exhaustive]
pub struct ContainerSpec { pub name: String, pub project: String, pub resource: String, pub image: ImageSource, pub env: HashMap<String, String>, pub ports: Vec<PortBinding>, pub volumes: Vec<VolumeBinding>, pub entrypoint: Option<Vec<String>>, pub command: Option<Vec<String>>, pub healthcheck: Option<HealthcheckSpec>, pub working_dir: Option<String>, }
Expand description

Self-contained description of a container to start, derived from a manifest resource declaration.

All fields are fully resolved: defaults have been applied, optional values materialised, and duration strings parsed. Consumers (the runtime and the export pipeline) can use this struct directly without any further resolution.

Produced by from_resource when resolving a manifest, or built directly via ContainerSpec::new by consumers that synthesize a spec themselves.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§name: String

Container name, of the form <project>_<resource>.

Used as the actual container name when starting the container and as the DNS hostname reachable by other containers in the same network.

§project: String

Project name as declared in the manifest.

Attached as a container label so that lightshuttle ps and lightshuttle down can filter by project.

§resource: String

Resource name as declared in the manifest.

Attached as a container label so that the CLI can address a single resource by name within a project.

§image: ImageSource

How the container image is obtained: pulled from a registry or built locally from a Dockerfile.

§env: HashMap<String, String>

Environment variables to inject into the container at startup.

§ports: Vec<PortBinding>

Host-to-container port bindings to publish.

§volumes: Vec<VolumeBinding>

Volume and bind-mount mappings to attach.

§entrypoint: Option<Vec<String>>

Optional override for the image ENTRYPOINT, the executable the container runs.

A Command::Single string is wrapped as ["sh", "-c", ...]; a Command::Args list is passed through as-is. None leaves the image entrypoint in place.

§command: Option<Vec<String>>

Optional command that overrides the image default CMD.

A Command::Single string is wrapped as ["sh", "-c", ...]; a Command::Args list is passed through as-is.

§healthcheck: Option<HealthcheckSpec>

Optional healthcheck. For postgres and redis, a sensible default is injected when the manifest omits one.

§working_dir: Option<String>

Optional working directory override inside the container.

Implementations§

Source§

impl ContainerSpec

Source

pub fn new( name: String, project: String, resource: String, image: ImageSource, ) -> Self

Builds a ContainerSpec with no env, ports, volumes, entrypoint, command, healthcheck or working directory.

Intended for consumers that synthesize a spec directly rather than resolving one from a manifest via from_resource. Callers set the remaining fields as needed.

Trait Implementations§

Source§

impl Clone for ContainerSpec

Source§

fn clone(&self) -> ContainerSpec

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ContainerSpec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V