tanbushi commited on
Commit
496b622
·
1 Parent(s): 991859f
Files changed (1) hide show
  1. Dockerfile +15 -10
Dockerfile CHANGED
@@ -31,17 +31,22 @@ USER opencode
31
  # Create user's bin directory
32
  RUN mkdir -p /home/opencode/.local/bin
33
 
34
- # Create startup script
35
- RUN echo '#!/bin/sh\n\
36
- echo "Starting OpenCode AI Web Server..."\n\
37
- echo "Server will be available at http://0.0.0.0:7860"\n\
38
- echo "OpenAPI documentation available at http://0.0.0.0:7860/doc"\n\
39
- export PATH="/usr/local/bin:$PATH"\n\
40
- exec /usr/local/bin/opencode serve --hostname 0.0.0.0 --port 7860\n\
41
- ' > /home/opencode/.local/bin/start.sh && chmod +x /home/opencode/.local/bin/start.sh
 
 
 
 
 
42
 
43
  # Expose the port that HuggingFace Spaces expects
44
  EXPOSE 7860
45
 
46
- # Default command - start web server
47
- CMD ["/bin/sh", "-c", "ls -l /home/opencode/.local/bin/start.sh && whoami && pwd && exec /home/opencode/.local/bin/start.sh"]
 
31
  # Create user's bin directory
32
  RUN mkdir -p /home/opencode/.local/bin
33
 
34
+ # Create startup script using cat with heredoc to avoid newline issues
35
+ RUN cat > /home/opencode/.local/bin/start.sh << 'EOF'
36
+ #!/bin/ash
37
+ echo "Starting OpenCode AI Web Server..."
38
+ echo "Server will be available at http://0.0.0.0:7860 "
39
+ echo "OpenAPI documentation available at http://0.0.0.0:7860/doc "
40
+ exec /usr/local/bin/opencode serve --hostname 0.0.0.0 --port 7860
41
+ EOF
42
+
43
+ RUN chmod +x /home/opencode/.local/bin/start.sh
44
+
45
+ # 调试:验证脚本内容
46
+ RUN cat -A /home/opencode/.local/bin/start.sh
47
 
48
  # Expose the port that HuggingFace Spaces expects
49
  EXPOSE 7860
50
 
51
+ # 简化CMD,直接执行脚本
52
+ CMD ["/home/opencode/.local/bin/start.sh"]