Update Dockerfile
Browse files- Dockerfile +5 -9
Dockerfile
CHANGED
|
@@ -1,9 +1,5 @@
|
|
| 1 |
FROM node:20-slim
|
| 2 |
|
| 3 |
-
# System deps
|
| 4 |
-
# - tini: PID 1 signal handling
|
| 5 |
-
# - rsync: optional file migration utilities
|
| 6 |
-
# - sqlite3: for safe SQLite backup/restore
|
| 7 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 8 |
ca-certificates \
|
| 9 |
git \
|
|
@@ -13,20 +9,20 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 13 |
sqlite3 \
|
| 14 |
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
|
| 16 |
-
# IMPORTANT: Create mountpoint(s) early + make writable for UID 1000 runtime
|
| 17 |
-
# HF Docker Spaces docs mention UID 1000 runtime; /data is commonly used for persistence.<!--citation:1-->
|
| 18 |
RUN mkdir -p /data && chmod 777 /data
|
| 19 |
|
| 20 |
-
# Install OpenCode
|
| 21 |
RUN npm install -g opencode-ai
|
| 22 |
|
| 23 |
-
# Provide a no-op xdg-open shim to avoid noisy "Executable not found" logs
|
| 24 |
-
# (opencode web tries to open a browser; in headless containers it's meaningless)
|
| 25 |
RUN printf '#!/bin/sh\nexit 0\n' > /usr/local/bin/xdg-open && chmod +x /usr/local/bin/xdg-open
|
| 26 |
|
| 27 |
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 |
RUN chmod +x /home/node/start.sh
|
| 31 |
|
| 32 |
USER node
|
|
|
|
| 1 |
FROM node:20-slim
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 4 |
ca-certificates \
|
| 5 |
git \
|
|
|
|
| 9 |
sqlite3 \
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
|
|
|
|
|
|
| 12 |
RUN mkdir -p /data && chmod 777 /data
|
| 13 |
|
|
|
|
| 14 |
RUN npm install -g opencode-ai
|
| 15 |
|
|
|
|
|
|
|
| 16 |
RUN printf '#!/bin/sh\nexit 0\n' > /usr/local/bin/xdg-open && chmod +x /usr/local/bin/xdg-open
|
| 17 |
|
| 18 |
WORKDIR /home/node
|
| 19 |
+
|
| 20 |
COPY --chown=node:node start.sh /home/node/start.sh
|
| 21 |
COPY --chown=node:node opencode.json.example /home/node/opencode.json.example
|
| 22 |
+
|
| 23 |
+
# --- CRLF -> LF (重要:修复 /usr/bin/env: bash\r) ---
|
| 24 |
+
RUN sed -i 's/\r$//' /home/node/start.sh
|
| 25 |
+
|
| 26 |
RUN chmod +x /home/node/start.sh
|
| 27 |
|
| 28 |
USER node
|