Create Dockerfile
Browse files- Dockerfile +34 -0
Dockerfile
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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"]
|