Replaced cron with python scheduler and using python yaml library. Updated readme.

This commit is contained in:
2025-06-01 10:44:06 +00:00
parent 7ead6b4154
commit 1236970426
6 changed files with 201 additions and 255 deletions

View File

@ -1,30 +1,17 @@
FROM python:3.11-slim
# Install required utilities
RUN apt-get update && apt-get install -y \
curl \
cron \
tzdata \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y --no-install-recommends curl tzdata && rm -rf /var/lib/apt/lists/*
# Install python dependencies
RUN pip install --no-cache-dir requests
RUN pip install --no-cache-dir requests pyyaml schedule
# Create crontabs directory (if needed)
RUN mkdir -p /etc/crontabs
ENV TZ=Europe/Paris
# Copy scripts
COPY update-blocklist.py /usr/local/bin/update-blocklist.py
COPY entrypoint.py /usr/local/bin/entrypoint.py
# Make scripts executable
RUN chmod +x /usr/local/bin/update-blocklist.py /usr/local/bin/entrypoint.py
# Set default timezone (can be overridden with TZ env var)
ENV TZ=UTC
# Configure timezone (tzdata)
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Set entrypoint
ENTRYPOINT ["/usr/local/bin/entrypoint.py"]
WORKDIR /app
COPY blocklist_scheduler.py /app/blocklist_scheduler.py
RUN chmod +x /app/blocklist_scheduler.py
ENTRYPOINT ["python3", "/app/blocklist_scheduler.py"]