Spaces:
Paused
Paused
Update Dockerfile
Browse files12312638910114561478171819202122910112425121314152716173031321819# 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 \ 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 user
ENV HOME=/home/userWORKDIR /home/user/app# 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/app
# Optional: copy your Space repo contents into the imageCOPY --chown=user:user . .USER nodeWORKDIR /home/node/appCOPY --chown=node:node . .
# 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"]Dockerfile+6-21