Files
sysmonstm/services/alerts/Dockerfile
buenosairesam 9ddcb68131
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
fix proto import in docker
2026-01-22 18:45:46 -03:00

43 lines
1.1 KiB
Docker

# Multi-stage Dockerfile for Alerts service
FROM python:3.11-slim as base
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*
COPY services/alerts/requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
COPY shared /app/shared
COPY proto /app/proto
RUN python -m grpc_tools.protoc \
-I/app/proto \
--python_out=/app/shared \
--grpc_python_out=/app/shared \
/app/proto/metrics.proto \
&& sed -i 's/^import metrics_pb2/from shared import metrics_pb2/' /app/shared/metrics_pb2_grpc.py
COPY services/alerts /app/services/alerts
ENV PYTHONPATH=/app
ENV PYTHONUNBUFFERED=1
# =============================================================================
FROM base as development
RUN pip install --no-cache-dir watchfiles
CMD ["python", "-m", "watchfiles", "python services/alerts/main.py", "/app/services/alerts"]
# =============================================================================
FROM base as production
RUN useradd --create-home --shell /bin/bash appuser
USER appuser
CMD ["python", "services/alerts/main.py"]