diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..9d571a0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,23 @@ +# Git +.git/ +.gitignore + +# Documentation and tests (not needed in production image) +docs/ +tests/ +*.md + +# IDE and editor files +.vscode/ +.idea/ +*.swp +*.swo + +# Python cache +__pycache__/ +*.py[cod] +*$py.class + +# Hermes specific +*.jsonl +*.jsonl.offset \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..96656d0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +# Dockerfile for Hermes Agent +FROM python:3.12-slim + +WORKDIR /app + +# Install uv for fast, reliable dependency resolution (pinned for reproducibility) +COPY --from=ghcr.io/astral-sh/uv:0.5.25 /uv /bin/uv + +# Copy project files (explicit uv.lock required for --frozen) +COPY pyproject.toml uv.lock ./ +COPY src/ ./src/ + +# Install production dependencies only +RUN uv sync --frozen --no-dev + +# Ensure logs reach the container log driver immediately +ENV PYTHONUNBUFFERED=1 +ENV ALERTS_JSONL_PATH=/var/hermes/alerts.jsonl +ENV ALERT_OFFSET_PATH=/var/hermes/alerts.jsonl.offset +ENV METRICS_PORT=8091 + +RUN mkdir -p /var/hermes + +# metrics endpoint — implemented in task 2.7 +EXPOSE 8091 + +CMD ["uv", "run", "python", "-m", "agentic_node_ops.processor"] \ No newline at end of file diff --git a/src/agentic_node_ops/processor.py b/src/agentic_node_ops/processor.py index 4f7cc6a..a253510 100644 --- a/src/agentic_node_ops/processor.py +++ b/src/agentic_node_ops/processor.py @@ -187,3 +187,7 @@ def run_processor_loop( """ log.info("Starting alert processor loop (poll interval: %ss)", poll_interval) asyncio.run(_run_loop_async(db, dispatcher, poll_interval)) + + +if __name__ == "__main__": + run_processor_loop()