jamesw853 commited on
Commit
e1c3dc7
·
verified ·
1 Parent(s): 98936b8

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -6
Dockerfile CHANGED
@@ -23,19 +23,26 @@ RUN useradd -m -u 1000 -s /bin/bash user && \
23
  USER user
24
  WORKDIR /home/user
25
 
26
- # 安装 opencode(官方脚本)
27
- RUN curl -fsSL https://opencode.ai/install | bash
 
 
 
 
 
 
 
 
 
 
 
28
 
29
  ENV PATH="/home/user/.opencode/bin:${PATH}"
30
 
31
- # 可选:复制 opencode.json 配置文件(如果你有的话,去掉下面一行的注释)
32
- # COPY --chown=user opencode.json /home/user/.config/opencode/opencode.json
33
-
34
  # 复制同步脚本和 supervisor 配置
35
  COPY --chown=user sync_to_dataset.py /home/user/sync_to_dataset.py
36
  COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
37
 
38
- # 确保脚本可执行
39
  RUN chmod +x /home/user/sync_to_dataset.py
40
 
41
  EXPOSE 7860
 
23
  USER user
24
  WORKDIR /home/user
25
 
26
+ # 直接下载 opencode 二进制绕过安装脚本)
27
+ RUN ARCH=$(uname -m) && \
28
+ if [ "$ARCH" = "x86_64" ]; then ARCH="x64"; elif [ "$ARCH" = "aarch64" ]; then ARCH="arm64"; fi && \
29
+ OS=$(uname -s | tr '[:upper:]' '[:lower:]') && \
30
+ FILENAME="opencode-${OS}-${ARCH}.tar.gz" && \
31
+ VERSION="0.0.55" && \
32
+ URL="https://github.com/anomalyco/opencode/releases/download/v${VERSION}/${FILENAME}" && \
33
+ curl --retry 3 --retry-delay 2 --max-time 60 -fsSL -o /tmp/opencode.tar.gz "${URL}" && \
34
+ tar -xzf /tmp/opencode.tar.gz -C /tmp && \
35
+ mkdir -p /home/user/.opencode/bin && \
36
+ mv /tmp/opencode /home/user/.opencode/bin/ && \
37
+ chmod +x /home/user/.opencode/bin/opencode && \
38
+ rm /tmp/opencode.tar.gz
39
 
40
  ENV PATH="/home/user/.opencode/bin:${PATH}"
41
 
 
 
 
42
  # 复制同步脚本和 supervisor 配置
43
  COPY --chown=user sync_to_dataset.py /home/user/sync_to_dataset.py
44
  COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
45
 
 
46
  RUN chmod +x /home/user/sync_to_dataset.py
47
 
48
  EXPOSE 7860