crazylemonade commited on
Commit
1bb000f
Β·
verified Β·
1 Parent(s): b1d24dd

Delete entrypoint.sh

Browse files
Files changed (1) hide show
  1. entrypoint.sh +0 -40
entrypoint.sh DELETED
@@ -1,40 +0,0 @@
1
- #!/usr/bin/env bash
2
- # ─────────────────────────────────────────────────────────────────────────────
3
- # MinerU OCR Service β€” container entrypoint
4
- #
5
- # Sequence:
6
- # 1. Restore magic-pdf.json if wiped (HF container restart)
7
- # 2. Run validate.py (pre-flight dependency check)
8
- # β†’ exits 1 and kills container if any critical dep is missing
9
- # β†’ this surfaces a clear error in HF logs instead of a silent bad start
10
- # 3. Start uvicorn (single worker β€” CPU Basic, no RAM contention)
11
- # ─────────────────────────────────────────────────────────────────────────────
12
- set -e
13
-
14
- CONFIG_FILE="${HOME}/magic-pdf.json"
15
-
16
- # ── 1. Restore config if /root was wiped (HF container restart) ───────────────
17
- if [ ! -f "$CONFIG_FILE" ]; then
18
- echo "[entrypoint] magic-pdf.json missing β€” restoring from baked copy..."
19
- cp /app/config/magic-pdf.json "$CONFIG_FILE"
20
- fi
21
-
22
- echo "[entrypoint] Config : $CONFIG_FILE"
23
- echo "[entrypoint] Port : ${PORT:-7860}"
24
-
25
- # ── 2. Pre-flight validation ──────────────────────────────────────────────────
26
- # validate.py exits 0 on pass, exits 1 on any CRITICAL failure.
27
- # 'set -e' above ensures a non-zero exit from validate.py aborts this script,
28
- # preventing a broken uvicorn from starting and appearing healthy.
29
- echo "[entrypoint] Running pre-flight validation..."
30
- python /app/validate.py
31
- echo "[entrypoint] Validation passed."
32
-
33
- # ── 3. Start API server ───────────────────────────────────────────────────────
34
- echo "[entrypoint] Starting uvicorn on 0.0.0.0:${PORT:-7860}..."
35
- exec uvicorn main:app \
36
- --host 0.0.0.0 \
37
- --port "${PORT:-7860}" \
38
- --workers 1 \
39
- --timeout-keep-alive 120 \
40
- --log-level info