wohnbot/Dockerfile
2026-01-01 15:27:25 +01:00

28 lines
940 B
Docker

FROM mcr.microsoft.com/playwright/python:v1.57.0-jammy
WORKDIR /app
# Install dependencies first (leverages Docker cache)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy all Python source code and directories
COPY handlers/ ./handlers/
COPY tests/ ./tests/
COPY *.py ./
# 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
# Install custom fonts for plot rendering
COPY data/fonts/*.ttf /usr/share/fonts/truetype/custom/
RUN fc-cache -fv
# 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
CMD ["python", "-u", "main.py"]