mirror of
https://github.com/taylanbakircioglu/flowfish.git
synced 2026-09-16 15:45:14 +00:00
d7ca50b387
Multi-cluster dependency mapping, real-time network monitoring, impact analysis, and CI/CD integration capabilities. Made-with: Cursor
73 lines
1.7 KiB
Docker
73 lines
1.7 KiB
Docker
# Flowfish Change Detection Worker Dockerfile
|
|
#
|
|
# Standalone worker for detecting infrastructure changes.
|
|
# Can be scaled horizontally with leader election.
|
|
|
|
FROM python:3.11-slim as base
|
|
|
|
# Set environment variables
|
|
ENV PYTHONUNBUFFERED=1
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
|
|
# Worker-specific defaults
|
|
ENV CHANGE_DETECTION_ENABLED=true
|
|
ENV CHANGE_DETECTION_INTERVAL=60
|
|
ENV CHANGE_DETECTION_LOOKBACK_MINUTES=5
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
gcc \
|
|
g++ \
|
|
libpq-dev \
|
|
make \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Create app user
|
|
RUN useradd -m -u 1000 -s /bin/bash appuser
|
|
|
|
# Set work directory
|
|
WORKDIR /app
|
|
|
|
# Install Python dependencies (same as backend)
|
|
COPY backend/requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Install additional worker dependencies
|
|
RUN pip install --no-cache-dir httpx
|
|
|
|
# Copy source code
|
|
COPY backend/ .
|
|
|
|
# Copy proto files and generate
|
|
COPY proto/ ./proto_source/
|
|
RUN mkdir -p proto && \
|
|
python -m grpc_tools.protoc \
|
|
-I./proto_source \
|
|
--python_out=./proto \
|
|
--grpc_python_out=./proto \
|
|
proto_source/*.proto && \
|
|
for file in ./proto/*_pb2.py ./proto/*_pb2_grpc.py; do \
|
|
if [ -f "$file" ]; then \
|
|
sed -i 's/^import \(.*_pb2\)/from . import \1/' "$file"; \
|
|
fi \
|
|
done && \
|
|
touch proto/__init__.py && \
|
|
rm -rf proto_source
|
|
|
|
# OpenShift compatibility
|
|
RUN chown -R appuser:0 /app && \
|
|
chmod -R g=u /app
|
|
|
|
USER appuser
|
|
|
|
# Expose health check port
|
|
EXPOSE 8001
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
|
|
CMD curl -f http://localhost:8001/health || exit 1
|
|
|
|
# Run worker
|
|
CMD ["uvicorn", "worker_main:app", "--host", "0.0.0.0", "--port", "8001"]
|