File size: 1,900 Bytes
eb7554a
 
 
 
 
 
 
0f0c70c
eb7554a
 
 
 
0f0c70c
eb7554a
0f0c70c
 
 
 
eb7554a
 
0f0c70c
 
 
eb7554a
0f0c70c
 
eb7554a
 
 
b221b87
 
 
 
 
 
 
 
eb7554a
 
b221b87
 
 
eb7554a
 
b221b87
 
 
 
 
 
 
eb7554a
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# 使用 Ubuntu 作為基礎映像檔,方便安裝各種開發工具
FROM ubuntu:22.04

# 設定環境變數,避免安裝過程中出現互動式提示
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1

# 更新套件庫並安裝系統依賴、Git 與設定 PPA 所需工具
RUN apt-get update && apt-get install -y \
    curl \
    git \
    build-essential \
    software-properties-common \
    sudo \
    && add-apt-repository ppa:deadsnakes/ppa -y \
    && apt-get update \
    && apt-get install -y python3.14 python3.14-venv python3.14-dev \
    && curl -sS https://bootstrap.pypa.io/get-pip.py | python3.14 \
    && rm -rf /var/lib/apt/lists/*

# 設定 python3 與 python 為預設的 python3.14 指令
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.14 1 \
    && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.14 1

# 安裝 Node.js (v24) - 供前端 React PWA 及安裝 AI CLI 工具使用
RUN curl -fsSL https://deb.nodesource.com/setup_24.x | bash - \
    && apt-get install -y nodejs \
    && rm -rf /var/lib/apt/lists/*

# 全域安裝 AI 工具
RUN npm i -g @openai/codex

# 建立一個與本機相同 UID/GID 的非 root 開發者帳號 (避免權限問題)
ARG UID=1000
ARG GID=1000
RUN groupadd -g ${GID} developer || true \
    && useradd -m -u ${UID} -g ${GID} -s /bin/bash developer \
    && echo "developer ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

# 預先建立 .ssh 資料夾並設定權限,以便掛載金鑰
RUN mkdir -p /home/developer/.ssh && chown developer:developer /home/developer/.ssh

# 切換到開發者帳號
USER developer

# 安裝 Claude Code 原生版本 (會裝在 ~/.local/bin/claude)
RUN curl -fsSL https://claude.ai/install.sh | bash

# 將 Claude Code 加入環境變數
ENV PATH="/home/developer/.local/bin:${PATH}"

WORKDIR /workspace

# 設定預設執行的指令
CMD ["/bin/bash"]