Create Dockerfile
Browse files- Dockerfile +24 -0
Dockerfile
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM ubuntu:22.04
|
| 2 |
+
|
| 3 |
+
# 1. Install basic dependencies
|
| 4 |
+
RUN apt-get update && apt-get install -y \
|
| 5 |
+
curl \
|
| 6 |
+
sudo \
|
| 7 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 8 |
+
|
| 9 |
+
# 2. Add your .deb file and install it
|
| 10 |
+
COPY opencode.deb /tmp/opencode.deb
|
| 11 |
+
RUN dpkg -i /tmp/opencode.deb || apt-get install -f -y
|
| 12 |
+
|
| 13 |
+
# 3. Setup a non-root user (HF requirement)
|
| 14 |
+
RUN useradd -m -u 1000 user
|
| 15 |
+
USER user
|
| 16 |
+
ENV HOME=/home/user \
|
| 17 |
+
PATH=/home/user/.local/bin:$PATH
|
| 18 |
+
|
| 19 |
+
# 4. Set the working directory
|
| 20 |
+
WORKDIR $HOME/app
|
| 21 |
+
|
| 22 |
+
# 5. Launch OpenCode in web mode on port 7860
|
| 23 |
+
# HF Spaces ONLY work on port 7860
|
| 24 |
+
CMD ["opencode", "web", "--hostname", "0.0.0.0", "--port", "7860"]
|