wohnbot/Dockerfile

29 lines
940 B
Text
Raw Normal View History

FROM mcr.microsoft.com/playwright/python:v1.57.0-jammy
WORKDIR /app
2026-01-01 15:27:25 +01:00
# Install dependencies first (leverages Docker cache)
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/
COPY tests/ ./tests/
2026-01-01 15:27:25 +01:00
COPY *.py ./
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
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-27 11:59:04 +01:00
CMD ["python", "-u", "main.py"]