habppyar commited on
Commit
cae4f41
·
verified ·
1 Parent(s): 2820f7c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -12
Dockerfile CHANGED
@@ -1,8 +1,6 @@
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 \
@@ -11,20 +9,21 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
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"]
 
1
  FROM node:20-slim
2
 
3
+ # System deps as root
 
 
4
  RUN apt-get update && apt-get install -y --no-install-recommends \
5
  ca-certificates \
6
  git \
 
9
  rsync \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
+ # Install OpenCode globally (as root is fine for global npm install)
13
  RUN npm install -g opencode-ai
14
 
15
+ # Workdir + files
16
+ WORKDIR /home/node
 
 
17
 
18
+ COPY --chown=node:node start.sh /home/node/start.sh
19
+ COPY --chown=node:node opencode.json.example /home/node/opencode.json.example
20
 
21
+ RUN chmod +x /home/node/start.sh
22
+
23
+ # Drop to non-root user that already exists in the base image
24
+ USER node
25
 
26
  EXPOSE 7860
27
 
28
  ENTRYPOINT ["/usr/bin/tini", "--"]
29
+ CMD ["/home/node/start.sh"]