feat: daily paper rss generator with dockerfile + entrypoint

This commit is contained in:
Kunthawat Greethong
2026-06-27 14:36:43 +07:00
parent ffe8769875
commit 23fed6dd64
5 changed files with 242 additions and 33 deletions

47
Dockerfile Normal file
View File

@@ -0,0 +1,47 @@
# ─────────────────────────────────────────────
# HuggingFace Daily Paper RSS — Dockerfile
# ─────────────────────────────────────────────
# Two modes:
# 1. Run-once (default, for cron):
# docker run --rm -v ./feeds:/data hf-paper-rss
# 2. HTTP server (serve feeds):
# docker run --rm -p 8080:8080 -v ./feeds:/data hf-paper-rss serve
# ─────────────────────────────────────────────
FROM python:3.11-slim AS base
WORKDIR /app
# Install system deps
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install Python deps
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy app code
COPY parser.py rss_generator.py run.py run.sh ./
# Create output directory
RUN mkdir -p /data && chmod 777 /data
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python -c "import sys; sys.exit(0 if __import__('os').path.exists('/data/feed.xml') else 1)" \
|| true # Allow healthcheck to be optional
ENTRYPOINT ["python", "run.py"]
CMD ["--output-dir", "/data"]
# ─── Serve mode ───
FROM base AS serve
COPY server.py .
EXPOSE 8080
ENTRYPOINT ["python", "server.py"]
CMD ["--dir", "/data", "--port", "8080"]