diff --git a/.dockerignore b/.dockerignore index be66b2b..93dd057 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,40 +1,21 @@ -# Git -.git -.gitignore - -# Python -__pycache__ -*.py[cod] -*$py.class -*.so +__pycache__/ +*.pyc +*.pyo +*.pyd .Python -venv/ -.venv/ -env/ -.env +*.so +*.egg *.egg-info/ dist/ build/ - -# IDE -.vscode/ -.idea/ -*.swp -*.swo - -# Testing +.git/ +.gitignore .pytest_cache/ .coverage htmlcov/ - -# OS -.DS_Store -Thumbs.db - -# Docs -*.md -!README.md - -# Local +.env +.venv/ +venv/ *.log -*.tmp +.DS_Store +node_modules/ diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..ee32189 --- /dev/null +++ b/.env.example @@ -0,0 +1,10 @@ +# Environment variables for Opus Orchestrator + +# Required +MINIMAX_API_KEY=your_minimax_api_key_here +GITHUB_TOKEN=your_github_token_here + +# Optional +LOG_LEVEL=INFO +API_HOST=0.0.0.0 +API_PORT=8000 diff --git a/Dockerfile b/Dockerfile index 8bd0ced..3f9d0c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,51 +1,29 @@ -# ============================================================================= -# Opus Orchestrator AI - Dockerfile -# ============================================================================= -# Build: docker build -t opus-orchestrator . -# Run: docker run -p 8080:8080 -p 8000:8000 -e OPENAI_API_KEY=sk-... opus-orchestrator -# ============================================================================= +# Opus Orchestrator API +# Dockerfile FROM python:3.12-slim -# Labels -LABEL maintainer="mark@thefoldwithin.earth" -LABEL description="AI-powered book generation system" -LABEL version="0.2.0" - -# Set working directory WORKDIR /app # Install system dependencies -RUN apt-get update && apt-get install -y --no-install-recommends \ - build-essential \ - curl \ +RUN apt-get update && apt-get install -y \ + git \ && rm -rf /var/lib/apt/lists/* -# Copy project files -COPY pyproject.toml README.md install.sh ./ +# Copy requirements first for caching +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +# Copy application COPY opus_orchestrator/ ./opus_orchestrator/ -COPY config.example.yaml ./ +COPY README.md . -# Create virtual environment -RUN python -m venv /opt/venv -ENV PATH="/opt/venv/bin:$PATH" - -# Install Python dependencies -RUN pip install --no-cache-dir -e ".[all]" - -# Create non-root user -RUN useradd -m -u 1000 opus && \ - chown -R opus:opus /app - -# Switch to non-root user -USER opus - -# Expose ports -EXPOSE 8000 8080 +# Expose port +EXPOSE 8000 # Health check -HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ - CMD curl -f http://localhost:8000/health || exit 1 +HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \ + CMD curl -f http://localhost:8000/health || exit 1 -# Default command: start web UI -CMD ["python", "-m", "opus_orchestrator", "ui", "--port", "8080"] +# Run +CMD ["python", "-m", "opus_orchestrator.server"] diff --git a/deployments/docker-compose.yml b/deployments/docker-compose.yml new file mode 100644 index 0000000..de17eb8 --- /dev/null +++ b/deployments/docker-compose.yml @@ -0,0 +1,39 @@ +# Opus Orchestrator API +# Docker Compose for local development + +version: '3.8' + +services: + opus-api: + image: opus-orchestrator:latest + build: + context: . + dockerfile: Dockerfile + ports: + - "8000:8000" + environment: + - MINIMAX_API_KEY=${MINIMAX_API_KEY} + - GITHUB_TOKEN=${GITHUB_TOKEN} + - LOG_LEVEL=INFO + volumes: + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8000/health"] + interval: 30s + timeout: 10s + retries: 3 + + texlive-api: + image: alex11br/texlive-api + ports: + - "8080:8080" + volumes: + - texlive-cache:/root/.texlive + environment: + - TEXLIVE_ENGINE=xelatex + - MAX_TIMEOUT=180 + restart: unless-stopped + +volumes: + texlive-cache: