kovinape commited on
Commit
2787a02
·
verified ·
1 Parent(s): 9a22486

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -21
Dockerfile CHANGED
@@ -1,34 +1,19 @@
1
- # Hugging Face Spaces (Docker) runs a web server on port 7860 by default.
2
- # This image installs OpenCode (opencode) and runs the web UI.
3
-
4
  FROM node:20-slim
5
 
6
- # Basic deps + tini for clean signal handling
7
  RUN apt-get update && apt-get install -y --no-install-recommends \
8
- ca-certificates \
9
- git \
10
- curl \
11
- tini \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
- # Install OpenCode (provides the `opencode` CLI)
15
  RUN npm install -g opencode-ai
16
 
17
- # Create a non-root user (HF Spaces commonly expects UID 1000)
18
- RUN useradd -m -u 1000 user
19
- USER user
20
-
21
- ENV HOME=/home/user
22
- WORKDIR /home/user/app
23
 
24
- # Optional: copy your Space repo contents into the image
25
- COPY --chown=user:user . .
 
26
 
27
- # OpenCode web server port for HF Spaces
28
  EXPOSE 7860
29
 
30
- # IMPORTANT:
31
- # - Set OPENCODE_SERVER_PASSWORD as a HF Space Secret (recommended for public Spaces).
32
- # - Optionally set OPENCODE_SERVER_USERNAME too.
33
  ENTRYPOINT ["/usr/bin/tini","--"]
34
  CMD ["opencode","web","--hostname","0.0.0.0","--port","7860"]
 
 
 
 
1
  FROM node:20-slim
2
 
 
3
  RUN apt-get update && apt-get install -y --no-install-recommends \
4
+ ca-certificates git curl tini \
 
 
 
5
  && rm -rf /var/lib/apt/lists/*
6
 
 
7
  RUN npm install -g opencode-ai
8
 
9
+ # Create an app dir and give ownership to the existing "node" user (uid 1000)
10
+ RUN mkdir -p /home/node/app && chown -R node:node /home/node/app
 
 
 
 
11
 
12
+ USER node
13
+ WORKDIR /home/node/app
14
+ COPY --chown=node:node . .
15
 
 
16
  EXPOSE 7860
17
 
 
 
 
18
  ENTRYPOINT ["/usr/bin/tini","--"]
19
  CMD ["opencode","web","--hostname","0.0.0.0","--port","7860"]