| # DTO Framework Docker Image | |
| # Multi-stage build for Data Transfer Operations | |
| FROM python:3.10-slim as builder | |
| # Install build dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| curl \ | |
| git \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create virtual environment | |
| RUN python -m venv /opt/venv | |
| ENV PATH="/opt/venv/bin:$PATH" | |
| # Install Python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Runtime stage | |
| FROM python:3.10-slim as runtime | |
| # Install runtime dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| curl \ | |
| git \ | |
| fuse \ | |
| rsync \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy virtual environment | |
| COPY --from=builder /opt/venv /opt/venv | |
| ENV PATH="/opt/venv/bin:$PATH" | |
| # Create DTO user | |
| RUN groupadd -r dto && useradd -r -g dto -d /app dto | |
| # Create application directory | |
| WORKDIR /app | |
| # Copy DTO framework | |
| COPY . . | |
| # Set permissions | |
| RUN chown -R dto:dto /app | |
| USER dto | |
| # Expose metrics port | |
| EXPOSE 9090 | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ | |
| CMD curl -f http://localhost:9090/health || exit 1 | |
| # Default command | |
| CMD ["python", "services/dto_service_manager.py"] |