Minimal docker project¶
Description¶
This example will show you a minimal project that will allow you to build a docker
image that will be able to run your orchestration files.
Project description¶
Project tree
minimal_docker_project
├── code/
│ ├── main.py
│ └── run_templates/
│ └── RUN/
│ └── run.json
├── Dockerfile
└── requirements.txt
File content¶
code/main.py | |
---|---|
1 2 3 |
|
This python file will be run by using a simple orchestration file.
code/run_templates/RUN/run.json | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 |
|
Now we only need to add our requirements for the project:
requirements.txt
cosmotech-run-orchestrator==1.1.0
And to finish a simple Dockerfile to build our docker image:
Dockerfile
FROM python:latest
COPY requirements.txt .
RUN python3 -m pip install -r requirements.txt
# The code folder must be set in this position to work
# with the predefined entrypoint of csm-orc
COPY code /pkg/share/code
# Defining a run template ID here allows to have a default for the image
# and thus avoid having to define the EnvVar at run
ENV CSM_RUN_TEMPLATE_ID=RUN
# The following command is the entrypoint defined by csm-orc that will do
# a default run of your template.
# This command is hidden in the list of commands,
# but you can check it by running `csm-orc entrypoint --help`
ENTRYPOINT ["csm-orc", "entrypoint"]
Build the image¶
The image can be simply built using the following command:
Build the docker image
docker build . -t minimal_docker_orchestrator
Run the image¶
The image can then be run using the following command:
Run the docker image
docker run example_orc
Possible environment variables with the Cosmo Tech API¶
The Cosmo Tech API can send the following list of environment variable to your docker image which will be available for any orchestration file you may want to run in it
List of environment variables
{{ read_yaml('partials/tutorial/advanced_cosmotech_simulator/api_envvars.yaml') }}