diff --git a/src/batou_ext/oci.py b/src/batou_ext/oci.py index c5010f6..dd77156 100644 --- a/src/batou_ext/oci.py +++ b/src/batou_ext/oci.py @@ -1,6 +1,7 @@ import hashlib import os import re +import shlex from typing import Optional import pkg_resources @@ -31,6 +32,7 @@ class Container(Component): # specific options entrypoint: Optional[str] = None + docker_cmd: Optional[str] = None envfile: Optional[str] = None mounts: dict = {} ports: dict = {} @@ -66,6 +68,9 @@ def configure(self): # spec version overrides the argument provided or default version if spec_tag: self.version = spec_tag + else: + # append version to image string when passed seperately + self.image = f"{self.image}:{self.version}" else: raise RuntimeError( f"could not match the docker spec against the provided container image string: '{self.image}'" @@ -87,6 +92,9 @@ def configure(self): ) self.envfile = self._ + if self.docker_cmd: + self._docker_cmd_list = shlex.split(self.docker_cmd) + self += File( f"/etc/local/nixos/docker_{self.container_name}.nix", sensitive_data=True, diff --git a/src/batou_ext/resources/oci-template.nix b/src/batou_ext/resources/oci-template.nix index 2c3465f..555ab4d 100644 --- a/src/batou_ext/resources/oci-template.nix +++ b/src/batou_ext/resources/oci-template.nix @@ -17,10 +17,14 @@ virtualisation.oci-containers = { backend = "docker"; containers."{{component.container_name}}" = { - # {% if component.entrypoint != None %} + # {% if component.entrypoint %} entrypoint = "{{component.entrypoint}}"; # {% endif %} + # {% if component.docker_cmd %} + cmd = [ {% for cmd in component._docker_cmd_list %} "{{cmd}}" {% endfor %} ]; + # {% endif %} + # {% if component.registry_address %} login = { registry = "{{component.registry_address}}"; diff --git a/src/batou_ext/s3.py b/src/batou_ext/s3.py index 7bead21..6bf5925 100644 --- a/src/batou_ext/s3.py +++ b/src/batou_ext/s3.py @@ -29,7 +29,13 @@ class S3(batou.component.Component): - """Configuration for an S3 connection and its credentials.""" + """Configuration for an S3 connection and its credentials. + + Keyword arguments: + access_key_id -- The S3 access key ID + secret_access_key -- The S3 secret access key + endpoint_url -- The S3 enpoint's URL + """ _required_params_ = { "access_key_id": "value",