Spaces:
Paused
Paused
Update Dockerfile
Browse files12345678910111213141516171819202122232425262728293031323334# Hugging Face Spaces (Docker) runs a web server on port 7860 by default.# This image installs OpenCode (opencode) and runs the web UI.FROM node:20-slim# Basic deps + tini for clean signal handlingRUN apt-get update && apt-get install -y --no-install-recommends \ca-certificates \git \curl \tini \&& rm -rf /var/lib/apt/lists/*# Install OpenCode (provides the `opencode` CLI)RUN npm install -g opencode-ai# Create a non-root user (HF Spaces commonly expects UID 1000)RUN useradd -m -u 1000 userUSER userENV HOME=/home/userWORKDIR /home/user/app# Optional: copy your Space repo contents into the imageCOPY --chown=user:user . .# OpenCode web server port for HF SpacesEXPOSE 7860# IMPORTANT:# - Set OPENCODE_SERVER_PASSWORD as a HF Space Secret (recommended for public Spaces).# - Optionally set OPENCODE_SERVER_USERNAME too.ENTRYPOINT ["/usr/bin/tini","--"]CMD ["opencode","web","--hostname","0.0.0.0","--port","7860"]12345678910111213141516171819FROM node:20-slimRUN apt-get update && apt-get install -y --no-install-recommends \ca-certificates git curl tini \&& rm -rf /var/lib/apt/lists/*RUN npm install -g opencode-ai# Create an app dir and give ownership to the existing "node" user (uid 1000)RUN mkdir -p /home/node/app && chown -R node:node /home/node/appUSER nodeWORKDIR /home/node/appCOPY --chown=node:node . .EXPOSE 7860ENTRYPOINT ["/usr/bin/tini","--"]CMD ["opencode","web","--hostname","0.0.0.0","--port","7860"]
Dockerfile+6-21