bk939448 commited on
Commit
c5f7f9d
·
verified ·
1 Parent(s): b50dcbf

Delete entrypoint.sh

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