This commit is contained in:
Holden
2026-06-10 16:44:41 -04:00
parent 14b59ebc93
commit 9aded6e181
2 changed files with 7 additions and 15 deletions
+3 -2
View File
@@ -15,7 +15,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
git \
curl \
g++ \
cron \
&& rm -rf /var/lib/apt/lists/* \
&& ln -sf /usr/bin/python3.12 /usr/bin/python \
&& ln -sf /usr/bin/python3.12 /usr/bin/python3
@@ -27,9 +26,10 @@ WORKDIR /app
RUN git clone --depth 1 https://github.com/sudolulo/if_curator_headless.git . \
&& uv sync --extra gpu \
&& uv add croniter \
&& uv cache clean
COPY entrypoint.sh /app/entrypoint.sh
COPY entrypoint.sh scheduler.py /app/
RUN chmod +x /app/entrypoint.sh
RUN groupadd -g 568 apps \
@@ -43,3 +43,4 @@ ENV FORCE_CPU=false \
INSIGHTFACE_HOME=/models/insightface
ENTRYPOINT ["/app/entrypoint.sh"]
+4 -13
View File
@@ -9,18 +9,9 @@ if [ -z "$SCHEDULE" ]; then
exit 0
fi
# Validate cron expression
if ! echo "$SCHEDULE" | cron-validate 2>/dev/null; then
echo "⚠️ Could not validate cron expression, attempting anyway: $SCHEDULE"
fi
echo "▶ CRON_SCHEDULE set to: $SCHEDULE"
echo "▶ Running if-curator on schedule..."
# Write cron job (run as appuser)
CRON_CMD="cd /app && /root/.local/bin/uv run if-curator >> /proc/1/fd/1 2>&1"
echo "$SCHEDULE appuser $CRON_CMD" > /etc/crontab
# Hand off to the Python scheduler
exec uv run python3 /app/scheduler.py
echo "▶ Scheduled with cron: $SCHEDULE"
echo "▶ Next run: $(crontab -l 2>/dev/null || echo 'see /etc/crontab')"
# Start cron daemon in foreground
echo "▶ Cron daemon started. Waiting for scheduled runs..."
cron -f