Update Dockerfile
Browse files7 unmodified lines891011121314151617181920212223242526272829303132337 unmodified lines&& rm -rf /var/lib/apt/lists/*# Install OpenCode globally via NPM to bypass the bash script rate-limit error.# Since this base image is node:20, npm is already available natively.RUN npm install -g opencode-ai# Hugging Face Spaces runs containers as UID 1000.RUN useradd -m -u 1000 userENV HOME=/home/user# Make sure the `user` account picks up /usr/local/bin# (where npm installs global packages).ENV PATH=/home/user/.local/bin:/usr/local/bin:${PATH}# Create a workspace directory the user can clone projects into and own it.RUN mkdir -p $HOME/workspace && chown -R user:user $HOMEUSER userWORKDIR $HOME/workspace# The port must match `app_port` in the README's YAML block.EXPOSE 4096# Start the OpenCode web server.# --hostname 0.0.0.0 => reachable by HF's reverse proxy (not just localhost)# OPENCODE_SERVER_PASSWORD env var (set as a Space secret) enables basic auth.CMD ["opencode", "serve", "--port", "4096", "--hostname", "0.0.0.0"]7 unmodified lines89101112131415161718192021222324252627282930317 unmodified lines&& rm -rf /var/lib/apt/lists/*# Install OpenCode globally via NPM to bypass the bash script rate-limit error.RUN npm install -g opencode-ai# The node base image ALREADY has a user with UID 1000 named "node".# We will use this existing user for Hugging Face Spaces.ENV HOME=/home/node# Make sure the `node` account picks up /usr/local/binENV PATH=/home/node/.local/bin:/usr/local/bin:${PATH}# Create a workspace directory the user can clone projects into and own it.RUN mkdir -p $HOME/workspace && chown -R node:node $HOME# Switch to the existing UID 1000 userUSER nodeWORKDIR $HOME/workspace# The port must match `app_port` in the README's YAML block.EXPOSE 4096# Start the OpenCode web server.CMD ["opencode", "serve", "--port", "4096", "--hostname", "0.0.0.0"]
Dockerfile+9-11