habppyar commited on
Commit
ee01858
·
verified ·
1 Parent(s): 535827f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -6
Dockerfile CHANGED
@@ -1,12 +1,30 @@
1
  FROM node:20-slim
2
 
3
- USER node
4
- WORKDIR /home/node/app
 
 
 
 
 
 
 
 
5
 
6
- COPY --chown=node package*.json ./
7
- RUN npm install --loglevel=error --no-audit --no-fund --prefer-offline
8
 
9
- COPY --chown=node . .
 
 
 
 
 
 
 
 
10
 
11
  EXPOSE 7860
12
- CMD ["node", "server.js"]
 
 
 
1
  FROM node:20-slim
2
 
3
+ # Basic utilities:
4
+ # - tini: proper signal handling as PID 1
5
+ # - rsync: for safe migration of existing dirs into /data on first boot
6
+ RUN apt-get update && apt-get install -y --no-install-recommends \
7
+ ca-certificates \
8
+ git \
9
+ bash \
10
+ tini \
11
+ rsync \
12
+ && rm -rf /var/lib/apt/lists/*
13
 
14
+ # Install OpenCode (npm)
15
+ RUN npm install -g opencode-ai
16
 
17
+ # Non-root user (matches common HF Spaces practice)
18
+ RUN useradd -m -u 1000 user
19
+ USER user
20
+ WORKDIR /home/user
21
+
22
+ COPY --chown=user:user start.sh /home/user/start.sh
23
+ COPY --chown=user:user opencode.json.example /home/user/opencode.json.example
24
+
25
+ RUN chmod +x /home/user/start.sh
26
 
27
  EXPOSE 7860
28
+
29
+ ENTRYPOINT ["/usr/bin/tini", "--"]
30
+ CMD ["/home/user/start.sh"]