fix cron
This commit is contained in:
+3
-2
@@ -15,7 +15,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
git \
|
git \
|
||||||
curl \
|
curl \
|
||||||
g++ \
|
g++ \
|
||||||
cron \
|
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
&& ln -sf /usr/bin/python3.12 /usr/bin/python \
|
&& ln -sf /usr/bin/python3.12 /usr/bin/python \
|
||||||
&& ln -sf /usr/bin/python3.12 /usr/bin/python3
|
&& 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 . \
|
RUN git clone --depth 1 https://github.com/sudolulo/if_curator_headless.git . \
|
||||||
&& uv sync --extra gpu \
|
&& uv sync --extra gpu \
|
||||||
|
&& uv add croniter \
|
||||||
&& uv cache clean
|
&& uv cache clean
|
||||||
|
|
||||||
COPY entrypoint.sh /app/entrypoint.sh
|
COPY entrypoint.sh scheduler.py /app/
|
||||||
RUN chmod +x /app/entrypoint.sh
|
RUN chmod +x /app/entrypoint.sh
|
||||||
|
|
||||||
RUN groupadd -g 568 apps \
|
RUN groupadd -g 568 apps \
|
||||||
@@ -43,3 +43,4 @@ ENV FORCE_CPU=false \
|
|||||||
INSIGHTFACE_HOME=/models/insightface
|
INSIGHTFACE_HOME=/models/insightface
|
||||||
|
|
||||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||||
|
|
||||||
|
|||||||
+4
-13
@@ -9,18 +9,9 @@ if [ -z "$SCHEDULE" ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Validate cron expression
|
echo "▶ CRON_SCHEDULE set to: $SCHEDULE"
|
||||||
if ! echo "$SCHEDULE" | cron-validate 2>/dev/null; then
|
echo "▶ Running if-curator on schedule..."
|
||||||
echo "⚠️ Could not validate cron expression, attempting anyway: $SCHEDULE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Write cron job (run as appuser)
|
# Hand off to the Python scheduler
|
||||||
CRON_CMD="cd /app && /root/.local/bin/uv run if-curator >> /proc/1/fd/1 2>&1"
|
exec uv run python3 /app/scheduler.py
|
||||||
echo "$SCHEDULE appuser $CRON_CMD" > /etc/crontab
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|||||||
Reference in New Issue
Block a user