Fix Dockerfile to ensure HOME environment variable is correctly set during OpenCode installation, preventing installation to the root directory. This change enhances compatibility with the user environment.
Browse files- Dockerfile +2 -1
Dockerfile
CHANGED
|
@@ -18,7 +18,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 18 |
RUN mkdir -p /home/user/app
|
| 19 |
|
| 20 |
# 使用官方安装脚本安装 opencode 到 /home/user/.opencode/bin
|
| 21 |
-
|
|
|
|
| 22 |
|
| 23 |
# 将 /home/user 归属给 UID 1000(HF Spaces 运行时使用 UID 1000)
|
| 24 |
RUN chown -R 1000:1000 /home/user
|
|
|
|
| 18 |
RUN mkdir -p /home/user/app
|
| 19 |
|
| 20 |
# 使用官方安装脚本安装 opencode 到 /home/user/.opencode/bin
|
| 21 |
+
# 必须让管道右侧的 bash 也继承 HOME,否则脚本会装到 /root/.opencode/bin
|
| 22 |
+
RUN bash -c 'export HOME=/home/user; curl -fsSL https://opencode.ai/install | bash -s -- --no-modify-path'
|
| 23 |
|
| 24 |
# 将 /home/user 归属给 UID 1000(HF Spaces 运行时使用 UID 1000)
|
| 25 |
RUN chown -R 1000:1000 /home/user
|