π³ Consolidation: Defining Stable, Self-Contained Methodsο
The CCP platform supports two main approaches for method execution:
Runtime-based methods (simplified, flexible, ideal for prototyping)
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:
Copy your scripts inside
Install any required libraries
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 containerYou 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 imagesKeep your Docker images small and clean
Test your method on CCP after publishing the image