tanbushi commited on
Commit
c79782b
·
1 Parent(s): 93ea22c
Files changed (3) hide show
  1. .gitignore +2 -0
  2. Dockerfile +49 -0
  3. push.sh +3 -0
.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ __pycache__/
2
+ .DS_Store
Dockerfile ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use Node.js 20 LTS as base image
2
+ FROM node:20-alpine
3
+
4
+ # Set environment variables
5
+ ENV NODE_ENV=production
6
+ ENV PORT=7860
7
+
8
+ # Install git and other system dependencies
9
+ RUN apk add --no-cache git curl
10
+
11
+ # Create app directory
12
+ WORKDIR /app
13
+
14
+ # Install opencode globally
15
+ RUN npm install -g opencode-ai@latest
16
+
17
+ # Create a non-root user
18
+ RUN addgroup -g 1001 -S opencode && \
19
+ adduser -S opencode -u 1001
20
+
21
+ # Change ownership of the app directory
22
+ RUN chown -R opencode:opencode /app
23
+
24
+ # Switch to non-root user
25
+ USER opencode
26
+
27
+ # Expose the port that HuggingFace Spaces expects
28
+ EXPOSE 7860
29
+
30
+ # Set the working directory for the user
31
+ WORKDIR /home/opencode
32
+
33
+ # Create a workspace directory for opencode
34
+ RUN mkdir -p /home/opencode/workspace && \
35
+ chown -R opencode:opencode /home/opencode/workspace
36
+
37
+ # Set working directory to workspace
38
+ WORKDIR /home/opencode/workspace
39
+
40
+ # Create startup script for web server
41
+ RUN echo '#!/bin/sh\n\
42
+ echo "Starting OpenCode AI Web Server..."\n\
43
+ echo "Server will be available at http://0.0.0.0:7860"\n\
44
+ echo "OpenAPI documentation available at http://0.0.0.0:7860/doc"\n\
45
+ exec opencode serve --hostname 0.0.0.0 --port 7860\n\
46
+ ' > /home/opencode/start.sh && chmod +x /home/opencode/start.sh
47
+
48
+ # Default command - start web server
49
+ CMD ["/home/opencode/start.sh"]
push.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ git add .
2
+ git commit -m "update"
3
+ git push