initial commit

Signed-off-by: ale <ale@manalejandro.com>
Este commit está contenido en:
ale
2025-10-12 00:55:02 +02:00
commit a82b1d8678
Se han modificado 15 ficheros con 4457 adiciones y 0 borrados

86
Dockerfile Archivo normal
Ver fichero

@@ -0,0 +1,86 @@
# HDH Deployment Docker Image
# Multi-stage build for production-ready HDH deployment
# Special thanks to Maria Gragera Garces for the HDH library!
FROM python:3.11-slim as builder
# Set build arguments
ARG BUILD_DATE
ARG VERSION=1.0.0
# Install system dependencies for building
RUN apt-get update && apt-get install -y \
build-essential \
cmake \
git \
pkg-config \
libmetis-dev \
&& rm -rf /var/lib/apt/lists/*
# Set work directory
WORKDIR /app
# Copy requirements and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
# Production stage
FROM python:3.11-slim as production
# Labels for image metadata
LABEL maintainer="HDH Deployment Team" \
description="HDH (Hybrid Dependency Hypergraph) Deployment Example" \
version="${VERSION}" \
build-date="${BUILD_DATE}" \
credits="Special thanks to Maria Gragera Garces for the HDH library"
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
libmetis5 \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
# Create non-root user for security
RUN groupadd -r hdh && useradd -r -g hdh -m hdh
# Copy Python dependencies from builder
COPY --from=builder /root/.local /home/hdh/.local
# Set work directory
WORKDIR /app
# Copy application files
COPY . .
# Copy HDH library (assuming it's in the parent directory)
COPY ../HDH ./HDH
# Install HDH library
RUN pip install -e ./HDH
# Create output directories
RUN mkdir -p hdh_results benchmark_results qasm_examples logs \
&& chown -R hdh:hdh /app
# Switch to non-root user
USER hdh
# Set environment variables
ENV PATH="/home/hdh/.local/bin:${PATH}" \
PYTHONPATH="/app:${PYTHONPATH}" \
MPLBACKEND=Agg \
HDH_OUTPUT_DIR="/app/hdh_results" \
HDH_LOG_LEVEL=INFO
# Expose port for potential web interface
EXPOSE 8080
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD python -c "import hdh; print('HDH library OK')" || exit 1
# Volume for persistent data
VOLUME ["/app/hdh_results", "/app/benchmark_results", "/app/logs"]
# Default command
CMD ["python", "main.py", "--demo-mode", "--output-dir", "/app/hdh_results"]