2025-12-09 11:30:17 +01:00
|
|
|
FROM mcr.microsoft.com/playwright/python:v1.57.0-jammy
|
2025-12-08 14:44:59 +01:00
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
2026-01-01 15:27:25 +01:00
|
|
|
# Install dependencies first (leverages Docker cache)
|
2025-12-08 14:44:59 +01:00
|
|
|
COPY requirements.txt .
|
|
|
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
|
2026-01-01 15:27:25 +01:00
|
|
|
# Copy all Python source code and directories
|
2025-12-27 11:59:04 +01:00
|
|
|
COPY handlers/ ./handlers/
|
2025-12-28 19:59:31 +01:00
|
|
|
COPY tests/ ./tests/
|
2026-01-01 15:27:25 +01:00
|
|
|
COPY *.py ./
|
2025-12-28 19:59:31 +01:00
|
|
|
|
2026-01-01 15:27:25 +01:00
|
|
|
# Setup data directory with proper permissions
|
|
|
|
|
RUN mkdir -p /app/data && chmod 777 /app/data && \
|
|
|
|
|
touch /app/data/state.json && chmod 666 /app/data/state.json
|
2025-12-31 16:19:14 +01:00
|
|
|
|
2026-01-01 15:27:25 +01:00
|
|
|
# Install custom fonts for plot rendering
|
2025-12-28 19:59:31 +01:00
|
|
|
COPY data/fonts/*.ttf /usr/share/fonts/truetype/custom/
|
|
|
|
|
RUN fc-cache -fv
|
|
|
|
|
|
2026-01-01 15:27:25 +01:00
|
|
|
# Health check: verify Python process is running and monitor.log is being updated
|
|
|
|
|
HEALTHCHECK --interval=5m --timeout=30s --start-period=30s --retries=3 \
|
|
|
|
|
CMD pgrep -f "python.*main.py" > /dev/null && \
|
|
|
|
|
test -f /app/data/monitor.log && \
|
|
|
|
|
test $(find /app/data/monitor.log -mmin -10 | wc -l) -gt 0 || exit 1
|
2025-12-08 14:44:59 +01:00
|
|
|
|
2025-12-27 11:59:04 +01:00
|
|
|
CMD ["python", "-u", "main.py"]
|