first claude draft

This commit is contained in:
buenosairesam
2025-12-29 14:40:06 -03:00
commit 116d4032e2
69 changed files with 5020 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
# Multi-stage Dockerfile for Collector service
# Stages: base -> development, base -> production
# =============================================================================
# Base stage - common dependencies
# =============================================================================
FROM python:3.11-slim as base
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY services/collector/requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Copy shared code and proto
COPY shared /app/shared
COPY proto /app/proto
# Generate gRPC code from proto
RUN python -m grpc_tools.protoc \
-I/app/proto \
--python_out=/app/shared \
--grpc_python_out=/app/shared \
/app/proto/metrics.proto
# Copy service code
COPY services/collector /app/services/collector
ENV PYTHONPATH=/app
ENV PYTHONUNBUFFERED=1
# =============================================================================
# Development stage - with hot reload
# =============================================================================
FROM base as development
RUN pip install --no-cache-dir watchfiles
CMD ["python", "-m", "watchfiles", "python services/collector/main.py", "/app/services/collector"]
# =============================================================================
# Production stage - optimized
# =============================================================================
FROM base as production
# Run as non-root user
RUN useradd --create-home --shell /bin/bash appuser
USER appuser
CMD ["python", "services/collector/main.py"]