🐳 Consolidation: Defining Stable, Self-Contained Methods

The CCP platform supports two main approaches for method execution:

  1. Runtime-based methods (simplified, flexible, ideal for prototyping)

  2. Consolidated methods (fully packaged, stable, ideal for production)

This guide explains how to create a consolidated method β€” where all dependencies and code are bundled into a custom Docker image.


πŸ’‘ Why Consolidate?

  • Avoid dependency installation at runtime

  • Ensure reproducibility, even in offline or secure environments

  • Package complex environments (e.g., Java, R, C++ with specific libs)

  • Protect source code if needed


🧱 What You Need

To consolidate a method, you must:

  • Build a custom Docker image with:

    • Your code already cloned

    • All dependencies pre-installed

    • Entrypoint ready to run your method

  • Push the image to a Docker registry (public or private)

  • Reference the image in your method.json


🐳 Docker Image Structure

Start from a base image (e.g., python:3.9, debian, etc.) and:

  1. Copy your scripts inside

  2. Install any required libraries

  3. Define a suitable entrypoint or script

Example Dockerfile (Python)

FROM python:3.9-slim

WORKDIR /app
COPY . /app

RUN pip install -r requirements.txt

ENTRYPOINT ["python", "main.py"]

Then build and push:

docker build -t registry.org/myproject:1.0 .
docker push registry.org/myproject:1.0

πŸ“„ Update method.json

Reference the consolidated image:

"ccpimage": {
  "default": "registry.org/myproject:1.0"
}

You don’t need a deploy script β€” all preparation is baked into the image.

If your entrypoint uses arguments (e.g., --input /ccp_data/input.txt), CCP will still inject parameters in the execute script.


πŸ“ File I/O Rules Still Apply

  • CCP mounts the /ccp_data/ folder inside your container

  • You must read all inputs from this directory

  • You must write all outputs to this directory


πŸ§ͺ Testing Your Image

Before publishing, always test locally:

docker run -v $(pwd)/testdata:/ccp_data registry.org/myproject:1.0     --input /ccp_data/sample.csv --output /ccp_data/output.txt

πŸ” Private Registries

If you want to use a private Docker image:

  • You must configure CCP to authenticate with the registry

  • This currently requires administrator-level integration


βœ… Summary

Feature Runtime-based Consolidated
Docker image CCP-provided Custom user image
Dependency install At runtime Pre-installed
Source code Cloned on the fly Included in image
Internet required Yes No
Performance Slower Faster, stable
Use case Testing, prototyping Production, secure

πŸ“Œ Best Practices

  • Use tags (e.g., :1.0) for immutable images

  • Keep your Docker images small and clean

  • Test your method on CCP after publishing the image