Custom Dependencies Image

Instead of using the pre-built dependencies docker images we provide, you may want/need to create custom ones. It can easily be done in just a few steps:

  1. Create the Dockerfile containing the custom dependencies you need. Any mix of publicly available packages and repository, and copies of libraries you have in your local system work.

  2. Build the docker image with your custom dependencies:

    docker build -t <registry>/<name>:<tag> .
    

    This will create the docker image and tag it. You can use any public registry, like quay.io or dockerhub, but make sure the image is public.

  3. Push the image to the registry:

    docker push <registry>/<name>:<tag>
    

Examples of docker files to create dependencies images are on the Arena repo, where we automatically build images for the RL libraries we support.

Once these steps are completed, you can submit the agent to the platform using your custom dependencies images. Assuming you are in the very same situation explained in the examples shown in the Submit Your Own Agent page, you would tweak them, respectively, as follows:

  • Example 1: Using a Manifest File (Recommended)

    Update the image name in the submission manifest:

    mode: AIvsCOM
    image: <registry>/<name>:<tag>
    version: v2.1
    command:
      - python
      - "/sources/agent.py"
      - "/sources/models/model.zip"
    sources:
      agent.py: https://{{.Secrets.token}}@raw.githubusercontent.com/path/to/trained-agent/your_agent.py
      models/model.zip: https://{{.Secrets.token}}@raw.githubusercontent.com/path/to/nn-weights/your_model.zip
    
  • Example 2: Command Line Interface Only

    Update the image name command line argument:

    diambra agent submit \
    --submission.mode AIvsCOM \
    --submission.version v2.1 \
    --submission.source agent.py=https://{{.Secrets.token}}@raw.githubusercontent.com/path/to/trained-agent/your_agent.py \
    --submission.source models/model.zip=https://{{.Secrets.token}}@raw.githubusercontent.com/path/to/nn-weights/your_model.zip \
    --submission.secret token=your_gh_token \
    --submission.set-command \
    <registry>/<name>:<tag> \
    python "/sources/agent.py" "/sources/models/model.zip"
    

Please note that the dependencies docker images needs to be public and will be publicly visible on the platform. Make sure you do not include in them any file you want to keep private.

Currently, we can only process Docker images built for amd64 CPU architecture. So, if you are using MacOS with M1 or M2 CPUs, you need to explicitly tell Docker to do that at build time as follows:

1. Open Docker Desktop Dashboard / Preferences (cog icon) / Turn “Experimental Features” on & apply
2. Create a new builder instance with docker buildx create --use
3. Run docker buildx build --platform linux/amd64 --push -t <image-tag> .

Note that:
- If you can’t see an “Experimental Features” option, sign up for the Docker developer program
- You have to push directly to a repository instead of doing it after build