Containerize fraud detection consumer - full Docker integration

- Added consumer/Dockerfile with all dependencies
- Updated consumer pipeline.py to use environment variables
- Updated features.py and decision.py to support env var configuration
- Updated docker-compose.yml to include consumer service
- Consumer now runs automatically with 'docker compose up'
- Proper Kafka and Redis networking for Docker
- Environment variables for ML_MODELS_DIR, KAFKA_BROKER, REDIS_HOST/PORT

Now entire PayGuard system runs with: docker compose up -d

Co-authored-by: Copilot <[email protected]>
This commit is contained in:
John Patrick TeruelandCopilot committed 2026-04-24 22:02:56 +08:00
1 parent 529914dd60
commit 4cefdb9083
6 files changed
+106 -14

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
FROM python:3.11-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements from root
COPY requirements.txt /tmp/
# Copy models module (includes __init__.py with class definitions and .pkl files)
COPY models /app/ml_models
# Copy consumer code
COPY consumer/ /app/
# Install Python dependencies
RUN pip install --no-cache-dir -r /tmp/requirements.txt
# Set environment for Docker network and models location
ENV KAFKA_BROKER=kafka:29092
ENV REDIS_URL=redis://redis:6379
ENV ML_MODELS_DIR=/app/ml_models
ENV PYTHONPATH=/app:/app/ml_models
# Run the consumer pipeline
CMD ["python3", "pipeline.py"]