Update Dockerfile
Browse files- Dockerfile +17 -10
Dockerfile
CHANGED
|
@@ -1,26 +1,33 @@
|
|
| 1 |
FROM node:20-slim
|
| 2 |
|
| 3 |
-
# System deps
|
| 4 |
-
# -
|
| 5 |
-
# -
|
|
|
|
| 6 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 7 |
ca-certificates \
|
| 8 |
bash \
|
|
|
|
| 9 |
tini \
|
| 10 |
git \
|
| 11 |
rsync \
|
| 12 |
sqlite3 \
|
| 13 |
python3 \
|
| 14 |
-
python3-
|
| 15 |
&& rm -rf /var/lib/apt/lists/*
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
# Install OpenCode
|
| 18 |
RUN npm install -g opencode-ai
|
| 19 |
|
| 20 |
-
# Install Hugging Face CLI (`hf`) via huggingface_hub
|
| 21 |
-
# The CLI includes `hf buckets cp` / `hf buckets sync` etc.
|
| 22 |
-
RUN pip3 install --no-cache-dir -U "huggingface_hub[cli]"
|
| 23 |
-
|
| 24 |
# No-op xdg-open shim (opencode web tries to open browser; container is headless)
|
| 25 |
RUN printf '#!/bin/sh\nexit 0\n' > /usr/local/bin/xdg-open && chmod +x /usr/local/bin/xdg-open
|
| 26 |
|
|
@@ -28,11 +35,11 @@ WORKDIR /home/node
|
|
| 28 |
COPY --chown=node:node start.sh /home/node/start.sh
|
| 29 |
COPY --chown=node:node opencode.json.example /home/node/opencode.json.example
|
| 30 |
|
| 31 |
-
# CRLF
|
| 32 |
RUN sed -i 's/\r$//' /home/node/start.sh && chmod +x /home/node/start.sh
|
| 33 |
|
| 34 |
USER node
|
| 35 |
-
|
| 36 |
EXPOSE 7860
|
|
|
|
| 37 |
ENTRYPOINT ["/usr/bin/tini", "--"]
|
| 38 |
CMD ["/home/node/start.sh"]
|
|
|
|
| 1 |
FROM node:20-slim
|
| 2 |
|
| 3 |
+
# System deps
|
| 4 |
+
# - python3 + python3-venv: hf CLI installer uses venv
|
| 5 |
+
# - curl: to fetch installer
|
| 6 |
+
# - sqlite3: for consistent SQLite backup
|
| 7 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 8 |
ca-certificates \
|
| 9 |
bash \
|
| 10 |
+
curl \
|
| 11 |
tini \
|
| 12 |
git \
|
| 13 |
rsync \
|
| 14 |
sqlite3 \
|
| 15 |
python3 \
|
| 16 |
+
python3-venv \
|
| 17 |
&& rm -rf /var/lib/apt/lists/*
|
| 18 |
|
| 19 |
+
# Install Hugging Face CLI (official one-liner installer; creates its own venv)
|
| 20 |
+
# Place `hf` into /usr/local/bin so it's available to USER node.
|
| 21 |
+
ENV HF_HOME=/opt/hf
|
| 22 |
+
ENV HF_CLI_BIN_DIR=/usr/local/bin
|
| 23 |
+
RUN curl -LsSf https://hf.co/cli/install.sh | bash -s -- --no-modify-path
|
| 24 |
+
|
| 25 |
+
# Verify hf exists
|
| 26 |
+
RUN hf version && hf --help >/dev/null
|
| 27 |
+
|
| 28 |
# Install OpenCode
|
| 29 |
RUN npm install -g opencode-ai
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
# No-op xdg-open shim (opencode web tries to open browser; container is headless)
|
| 32 |
RUN printf '#!/bin/sh\nexit 0\n' > /usr/local/bin/xdg-open && chmod +x /usr/local/bin/xdg-open
|
| 33 |
|
|
|
|
| 35 |
COPY --chown=node:node start.sh /home/node/start.sh
|
| 36 |
COPY --chown=node:node opencode.json.example /home/node/opencode.json.example
|
| 37 |
|
| 38 |
+
# Safety: strip CRLF if any
|
| 39 |
RUN sed -i 's/\r$//' /home/node/start.sh && chmod +x /home/node/start.sh
|
| 40 |
|
| 41 |
USER node
|
|
|
|
| 42 |
EXPOSE 7860
|
| 43 |
+
|
| 44 |
ENTRYPOINT ["/usr/bin/tini", "--"]
|
| 45 |
CMD ["/home/node/start.sh"]
|