Docker Setup & Containerization
Relevant source files
The following files were used as context for generating this wiki page:
The eval-platform uses Docker to provide a consistent environment for developing, testing, and deploying evaluation workloads. Containerization ensures that all dependencies, including specific Python runtimes and database drivers, remain isolated from the host system.
The setup primarily consists of a multi-container architecture managed by Docker Compose. This architecture separates the application logic, the database, and the worker processes into distinct services to improve scalability and resource management.
Sources: README.md, docker-compose.yml
Container Architecture
The platform defines several interconnected services within the docker-compose.yml file. Each service fulfills a specific role in the evaluation lifecycle.
Core Services
| Service Name | Description | Image/Build Source |
|---|---|---|
web | The primary API and frontend interface. | ./Dockerfile |
db | Persistent PostgreSQL storage for evaluation results. | postgres:15-alpine |
worker | Background task processor for heavy compute. | ./Dockerfile |
redis | Message broker and caching layer. | redis:7-alpine |
Sources: docker-compose.yml:4-45
Service Dependencies
The following diagram illustrates how the services interact and their startup order.
The application services (web and worker) depend on the availability of the infrastructure services (db and redis) before they can initialize successfully.
Sources: docker-compose.yml:10, 22, 35
Build Configuration
The Dockerfile defines a multi-stage build process to minimize image size and improve security.
- Base Layer: Uses a slim Python image to provide the runtime.
- Dependency Installation: Installs system packages required for database connections and scientific computing.
- App Setup: Copies the application code and installs Python dependencies listed in
requirements.txt. - Execution: Sets the default entry point to run the application server or the worker process based on environment variables.
Sources: Dockerfile:1-25
Environment Configuration
The container environment is configured using an .env file. Users must copy .env.example to .env before starting the containers.
| Variable | Usage | Default |
|---|---|---|
POSTGRES_PASSWORD | Password for the database service. | password |
REDIS_URL | Connection string for the Redis service. | redis://redis:6379/0 |
APP_PORT | Port exposed by the web container. | 8000 |
Sources: .env.example:1-12
Setup Procedure
To initialize the Docker environment, follow these steps:
- Clone the repository to your local machine.
- Create the environment file:
cp .env.example .env. - Run the setup script to check for Docker installation:
./scripts/setup_docker.sh. - Build and start the services:
docker-compose up --build -d.
The setup script validates that the Docker daemon is running and that the current user has sufficient permissions to manage containers.
Sources: scripts/setup_docker.sh:5-15, README.md
Summary
The Docker setup provides a modular and reproducible infrastructure for the eval-platform. By isolating components like the database and worker into separate containers, the system achieves better resource allocation and simplifies the deployment process across different environments.