Configuration
image
The image
key defines the type of image on which to run your code
Overview
alto.yml
Introduced in v0.0.5
, the image configuration option gives you the ability to run your
code in a custom image within their infrastructure’s environment. For example, you can
run their code on a Docker image within their EC2 instance.
Why use images?
Great question! After all, agents are already their own execution environment — what’s the additional benefit of using images? There are a few:
- Python versioning: let’s say that your project relies on a version of Python that doesn’t come pre-installed on your agent (e.g., your project relies on Python 3.10, but your agent only has Python 3.9 out-of-the-box). Installing a new version of Python on an agent can take a while — rather than deal with this, it’s easier to use an image to handle your code’s execution.
- Dependency management: same story as above — let’s say your project relies on a package version that isn’t compatible with your agent’s runtime current version of Python. Rather than having to rollback your local Python installation or install another version of Python on your machine, you can run your code in an agent with a pre-specified Python version.
- Agent-agnostic deployment: images don’t care what agent they’re run on. That is, if you were to run your code on the agent’s environment itself, you may have to tweak the code slightly if you decide to change the agent type (e.g., from an EC2 instance to an EMR cluster). Using an image eliminates this concern, since the codes runtime is separate from the agent’s runtime.
Key Specification
The image
key accepts the following keys:
Required keys
type
: the image type. As of now, the supported types are:docker
base
: the base image upon which to build your custom image. This cannot be specified alongsidecontext
.context
: path to the image context to use to build the image (e.g., the image Dockerfile). If this is specified, then all other image build parameters are ignored. This cannot be specified alongsidebase
.
base
and context
are mutually exclusive. If base
is specified, then Alto
will build your context (e.g., your Dockerfile) for you. Otherwise, Alto will rely on
the context at the path you provideOptional keys
image_build_cmds
: custom commands to run when building your image (e.g.,apt ...
).registry
: the registry in which to push your image. As of now, the supported types are:dockerhub
andecr
. If not specified, then defaults toecr
.registry_creds
: credentials for your chosen registry as nested key-value pairs:username
: your registry usernamepassword
: your registry password
If the
registry_creds
are not specified, then Alto will try to infer them or will prompt you for them.Example
Here’s a simple configuration for a Docker image on an EC2 agent:
alto.yml