Update Dockerfile
Browse files7 unmodified lines891011111214151613141516181920171819202324212223242526272829303132317 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# 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 `user` account picks up /usr/local/bin # (where npm installs global packages).ENV PATH=/home/user/.local/bin:/usr/local/bin:${PATH}# Make sure the `node` account picks up /usr/local/bin ENV 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 user:user $HOMEUSER userRUN 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.# --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"]Dockerfile+9-11