Files
HDH-example/docker-compose.yml
2025-10-12 00:55:02 +02:00

192 líneas
4.9 KiB
YAML

version: '3.8'
# HDH Deployment Docker Compose
# Comprehensive deployment setup for HDH library examples
# Special thanks to Maria Gragera Garces for the HDH library!
services:
# Main HDH deployment service
hdh-deployment:
build:
context: .
dockerfile: Dockerfile
args:
BUILD_DATE: ${BUILD_DATE:-$(date -u +'%Y-%m-%dT%H:%M:%SZ')}
VERSION: ${VERSION:-1.0.0}
container_name: hdh-deployment
restart: unless-stopped
environment:
- HDH_OUTPUT_DIR=/app/hdh_results
- HDH_LOG_LEVEL=${HDH_LOG_LEVEL:-INFO}
- PYTHONPATH=/app
- MPLBACKEND=Agg
volumes:
- hdh_results:/app/hdh_results
- benchmark_results:/app/benchmark_results
- logs:/app/logs
- ./config.yaml:/app/config.yaml:ro
# Mount additional QASM files if available
- ${QASM_DIR:-./qasm_examples}:/app/qasm_examples:ro
command: ["python", "main.py", "--demo-mode", "--output-dir", "/app/hdh_results"]
networks:
- hdh-network
labels:
- "hdh.service=deployment"
- "hdh.description=Main HDH deployment service"
- "hdh.credits=Thanks to Maria Gragera Garces"
# Benchmarking service
hdh-benchmark:
build:
context: .
dockerfile: Dockerfile
container_name: hdh-benchmark
restart: "no" # Run once
environment:
- HDH_OUTPUT_DIR=/app/benchmark_results
- HDH_LOG_LEVEL=${HDH_LOG_LEVEL:-INFO}
- PYTHONPATH=/app
- MPLBACKEND=Agg
volumes:
- benchmark_results:/app/benchmark_results
- logs:/app/logs
- ./config.yaml:/app/config.yaml:ro
command: [
"python", "benchmark.py",
"--suite", "all",
"--repetitions", "${BENCHMARK_REPETITIONS:-3}",
"--output-dir", "/app/benchmark_results"
]
networks:
- hdh-network
labels:
- "hdh.service=benchmark"
- "hdh.description=HDH performance benchmarking"
profiles:
- benchmark
# Circuit examples generator
hdh-examples:
build:
context: .
dockerfile: Dockerfile
container_name: hdh-examples
restart: "no" # Run once
environment:
- PYTHONPATH=/app
volumes:
- qasm_examples:/app/qasm_examples
- logs:/app/logs
command: ["python", "circuit_examples.py"]
networks:
- hdh-network
labels:
- "hdh.service=examples"
- "hdh.description=Generate quantum circuit examples"
profiles:
- examples
# Jupyter notebook service (optional)
hdh-jupyter:
build:
context: .
dockerfile: Dockerfile
container_name: hdh-jupyter
restart: unless-stopped
environment:
- JUPYTER_ENABLE_LAB=yes
- JUPYTER_TOKEN=${JUPYTER_TOKEN:-hdh-token}
- PYTHONPATH=/app
volumes:
- hdh_results:/app/hdh_results
- benchmark_results:/app/benchmark_results
- ./notebooks:/app/notebooks
- ./config.yaml:/app/config.yaml:ro
ports:
- "${JUPYTER_PORT:-8888}:8888"
command: [
"jupyter", "lab",
"--ip=0.0.0.0",
"--port=8888",
"--no-browser",
"--allow-root",
"--notebook-dir=/app"
]
networks:
- hdh-network
labels:
- "hdh.service=jupyter"
- "hdh.description=Jupyter Lab for interactive HDH analysis"
profiles:
- jupyter
# Web dashboard (placeholder for future development)
hdh-dashboard:
build:
context: .
dockerfile: Dockerfile
container_name: hdh-dashboard
restart: unless-stopped
environment:
- FLASK_APP=dashboard.py
- FLASK_ENV=${FLASK_ENV:-production}
- HDH_RESULTS_DIR=/app/hdh_results
volumes:
- hdh_results:/app/hdh_results:ro
- benchmark_results:/app/benchmark_results:ro
ports:
- "${DASHBOARD_PORT:-8080}:8080"
command: ["python", "-c", "print('Dashboard service placeholder - to be implemented')"]
networks:
- hdh-network
labels:
- "hdh.service=dashboard"
- "hdh.description=Web dashboard for HDH results"
profiles:
- dashboard
# Named volumes for persistent storage
volumes:
hdh_results:
driver: local
labels:
- "hdh.volume=results"
- "hdh.description=HDH processing results"
benchmark_results:
driver: local
labels:
- "hdh.volume=benchmarks"
- "hdh.description=Performance benchmark results"
qasm_examples:
driver: local
labels:
- "hdh.volume=examples"
- "hdh.description=Generated QASM examples"
logs:
driver: local
labels:
- "hdh.volume=logs"
- "hdh.description=Application logs"
# Custom network
networks:
hdh-network:
driver: bridge
labels:
- "hdh.network=main"
- "hdh.description=HDH deployment network"
# Environment variables with defaults
# Create a .env file to override these values:
#
# HDH_LOG_LEVEL=DEBUG
# BENCHMARK_REPETITIONS=5
# JUPYTER_TOKEN=your-secure-token
# JUPYTER_PORT=8888
# DASHBOARD_PORT=8080
# QASM_DIR=./qasm_files
# BUILD_DATE=2024-01-01T00:00:00Z
# VERSION=1.0.0