bk939448 commited on
Commit
ec2de37
·
verified ·
1 Parent(s): fbe2468

Delete entrypoint.sh

Browse files
Files changed (1) hide show
  1. entrypoint.sh +0 -62
entrypoint.sh DELETED
@@ -1,62 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Ensure HF CLI is in PATH
4
- export PATH="$HOME/.local/bin:$PATH"
5
-
6
-
7
- # Set HF Token from Space Secrets
8
- export HF_TOKEN="${HF_TOKEN}"
9
-
10
-
11
- # Variables
12
- BUCKET='hf://buckets/bk939448/opencodeai'
13
- SOURCE='/data'
14
-
15
-
16
- # Configure Git
17
- git config --global user.email 'badal@example.com'
18
- git config --global user.name 'Badal'
19
-
20
-
21
- # Set OpenCode path
22
- OP_PATH=$(find / -name opencode -type f -printf '%h' -quit 2>/dev/null)
23
- export PATH="$OP_PATH:$PATH"
24
-
25
-
26
- # ============================================
27
- # STEP 1: RESTORE (Try, but continue if bucket empty)
28
- # ============================================
29
- echo '=== [STEP 1] RESTORING DATA FROM BUCKET ==='
30
- if hf sync "$BUCKET" "$SOURCE" --delete 2>/dev/null; then
31
- echo '=== [STEP 1] RESTORE COMPLETE ==='
32
- else
33
- echo '=== [STEP 1] Restore skipped (bucket empty or failed - continuing anyway) ==='
34
- fi
35
-
36
-
37
- # ============================================
38
- # STEP 2: START OPENCODE
39
- # ============================================
40
- echo '=== [STEP 2] STARTING OPENCODE ==='
41
- export OPENCODE_SERVER_USERNAME=${OPENCODE_SERVER_USERNAME}
42
- export OPENCODE_SERVER_PASSWORD=${OPENCODE_SERVER_PASSWORD}
43
- opencode web --port 7860 --hostname 0.0.0.0 > /tmp/opencode.log 2>&1 &
44
- sleep 10
45
- echo '=== [STEP 2] OPENCODE STARTED ==='
46
-
47
-
48
- # ============================================
49
- # STEP 3: REAL-TIME CONTINUOUS SYNC
50
- # ============================================
51
- echo '=== [STEP 3] STARTING REAL-TIME SYNC ==='
52
- while true; do
53
- # Check if OpenCode is still running
54
- if ! pgrep -f 'opencode' > /dev/null; then
55
- echo 'CRITICAL: OpenCode process died! Exiting container...'
56
- exit 1
57
- fi
58
-
59
- # Real-time continuous sync (quiet mode)
60
- hf sync "$SOURCE" "$BUCKET" --delete --quiet
61
- sleep 2
62
- done