Replaced cron with python scheduler and using python yaml library. Updated readme.
This commit is contained in:
33
Dockerfile
33
Dockerfile
@ -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"]
|
||||
|
Reference in New Issue
Block a user