Update Dockerfile
Browse files- Dockerfile +30 -20
Dockerfile
CHANGED
|
@@ -1,26 +1,36 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
imagemagick \
|
| 9 |
-
pandoc \
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
#
|
| 16 |
-
|
| 17 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
EXPOSE
|
| 24 |
|
| 25 |
-
# Start the
|
| 26 |
-
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM node:20-bookworm-slim
|
| 2 |
+
|
| 3 |
+
# System dependencies
|
| 4 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 5 |
+
git \
|
| 6 |
+
ca-certificates \
|
| 7 |
+
curl \
|
|
|
|
|
|
|
| 8 |
&& rm -rf /var/lib/apt/lists/*
|
| 9 |
|
| 10 |
+
# Install OpenCode globally via the official installer.
|
| 11 |
+
# OPENCODE_INSTALL_DIR points the installer at /usr/local/bin so the
|
| 12 |
+
# `opencode` binary is on the default PATH for every user.
|
| 13 |
+
ENV OPENCODE_INSTALL_DIR=/usr/local/bin
|
| 14 |
+
RUN curl -fsSL https://opencode.ai/install | bash
|
| 15 |
+
|
| 16 |
+
# Hugging Face Spaces runs containers as UID 1000.
|
| 17 |
+
RUN useradd -m -u 1000 user
|
| 18 |
+
|
| 19 |
+
ENV HOME=/home/user
|
| 20 |
+
# Make sure the `user` account picks up /usr/local/bin (root's PATH already
|
| 21 |
+
# includes it, but $HOME/.local/bin is the conventional place for user bins).
|
| 22 |
+
ENV PATH=/home/user/.local/bin:/usr/local/bin:${PATH}
|
| 23 |
|
| 24 |
+
# Create a workspace directory the user can clone projects into and own it.
|
| 25 |
+
RUN mkdir -p $HOME/workspace && chown -R user:user $HOME
|
|
|
|
| 26 |
|
| 27 |
+
USER user
|
| 28 |
+
WORKDIR $HOME/workspace
|
| 29 |
|
| 30 |
+
# The port must match `app_port` in the README's YAML block.
|
| 31 |
+
EXPOSE 4096
|
| 32 |
|
| 33 |
+
# Start the OpenCode web server.
|
| 34 |
+
# --hostname 0.0.0.0 => reachable by HF's reverse proxy (not just localhost)
|
| 35 |
+
# OPENCODE_SERVER_PASSWORD env var (set as a Space secret) enables basic auth.
|
| 36 |
+
CMD ["opencode", "web", "--port", "4096", "--hostname", "0.0.0.0"]
|