Lenson commited on
Commit
bbaa5d7
·
1 Parent(s): 32c214d

feat: add .hf/setup.sh for HF Spaces compatibility

Browse files
Files changed (2) hide show
  1. .hf/setup.sh +22 -0
  2. Dockerfile.hfspaces +5 -6
.hf/setup.sh ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ echo "========================================"
5
+ echo " Codex Proxy - HF Spaces Setup"
6
+ echo "========================================"
7
+
8
+ # Ensure data directories exist
9
+ mkdir -p /app/data
10
+ mkdir -p /app/config
11
+
12
+ # Set HF Space environment variables if available
13
+ if [ -n "$HF_SPACE_ID" ]; then
14
+ echo "Running on Hugging Face Spaces: $HF_SPACE_ID"
15
+ fi
16
+
17
+ # Change to app directory
18
+ cd /app
19
+
20
+ # Start the server
21
+ echo "Starting Codex Proxy..."
22
+ exec node dist/index.js
Dockerfile.hfspaces CHANGED
@@ -36,12 +36,11 @@ EXPOSE 7860
36
  # Ensure data dir exists in the image (bind mount may override at runtime)
37
  RUN mkdir -p /app/data
38
 
39
- COPY docker-entrypoint.sh /
40
- COPY docker-healthcheck.sh /
41
- RUN chmod +x /docker-entrypoint.sh /docker-healthcheck.sh
42
 
43
  HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
44
- CMD /docker-healthcheck.sh
45
 
46
- ENTRYPOINT ["/docker-entrypoint.sh"]
47
- CMD ["node", "dist/index.js"]
 
36
  # Ensure data dir exists in the image (bind mount may override at runtime)
37
  RUN mkdir -p /app/data
38
 
39
+ COPY .hf/setup.sh /usr/local/bin/setup.sh
40
+ RUN chmod +x /usr/local/bin/setup.sh
 
41
 
42
  HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
43
+ CMD curl -f http://localhost:7860/health || exit 1
44
 
45
+ ENTRYPOINT ["/usr/local/bin/setup.sh"]
46
+ CMD []