Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +19 -24
Dockerfile
CHANGED
|
@@ -8,52 +8,47 @@ ENV PIP_DISABLE_PIP_VERSION_CHECK=1
|
|
| 8 |
ENV PYTHONDONTWRITEBYTECODE=1
|
| 9 |
ENV PYTHONUNBUFFERED=1
|
| 10 |
|
| 11 |
-
# 可固定 code-server 版本,提升可重复性
|
| 12 |
ARG CODE_SERVER_VERSION=4.109.2
|
| 13 |
|
| 14 |
-
# 1) 仅安装核心依赖(减重)
|
| 15 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 16 |
-
ca-certificates curl git bash sudo tini \
|
| 17 |
-
#
|
|
|
|
|
|
|
|
|
|
| 18 |
openjdk-17-jdk-headless maven \
|
| 19 |
-
# Node
|
| 20 |
nodejs npm \
|
| 21 |
-
# C/C++
|
| 22 |
-
build-essential g++ gcc make cmake ninja-build gdb clang clangd \
|
| 23 |
-
# 常用工具
|
| 24 |
-
jq procps unzip \
|
| 25 |
&& rm -rf /var/lib/apt/lists/*
|
| 26 |
|
| 27 |
-
#
|
| 28 |
RUN curl -fsSL "https://github.com/coder/code-server/releases/download/v${CODE_SERVER_VERSION}/code-server_${CODE_SERVER_VERSION}_amd64.deb" -o /tmp/code-server.deb \
|
| 29 |
&& dpkg -i /tmp/code-server.deb \
|
| 30 |
&& rm -f /tmp/code-server.deb
|
| 31 |
|
| 32 |
-
#
|
| 33 |
RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
|
| 34 |
pip install --no-cache-dir \
|
| 35 |
-
numpy pandas scipy scikit-learn matplotlib
|
| 36 |
-
|
| 37 |
requests httpx aiohttp pyyaml python-dotenv tqdm rich \
|
| 38 |
-
|
| 39 |
sqlalchemy alembic psycopg2-binary redis \
|
| 40 |
-
pytest
|
| 41 |
|
| 42 |
-
#
|
| 43 |
-
RUN npm install -g @openai/codex
|
| 44 |
|
| 45 |
-
#
|
| 46 |
RUN useradd -m -u 1000 -s /bin/bash coder \
|
| 47 |
&& echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \
|
| 48 |
&& mkdir -p /home/coder/.config/code-server /home/coder/.codex \
|
| 49 |
&& chown -R coder:coder /home/coder
|
| 50 |
|
| 51 |
-
#
|
| 52 |
-
RUN
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
su - coder -c "code-server --install-extension redhat.java || true"
|
| 57 |
|
| 58 |
COPY --chown=coder:coder start.sh /usr/local/bin/start.sh
|
| 59 |
RUN chmod +x /usr/local/bin/start.sh
|
|
|
|
| 8 |
ENV PYTHONDONTWRITEBYTECODE=1
|
| 9 |
ENV PYTHONUNBUFFERED=1
|
| 10 |
|
|
|
|
| 11 |
ARG CODE_SERVER_VERSION=4.109.2
|
| 12 |
|
|
|
|
| 13 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 14 |
+
ca-certificates curl git bash sudo tini jq procps unzip \
|
| 15 |
+
# C/C++ 基础工具链 + 头文件
|
| 16 |
+
build-essential gcc g++ make cmake ninja-build gdb clang clangd \
|
| 17 |
+
libc6-dev linux-libc-dev pkg-config \
|
| 18 |
+
# Java + Node
|
| 19 |
openjdk-17-jdk-headless maven \
|
|
|
|
| 20 |
nodejs npm \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
&& rm -rf /var/lib/apt/lists/*
|
| 22 |
|
| 23 |
+
# 安装 code-server(固定版本)
|
| 24 |
RUN curl -fsSL "https://github.com/coder/code-server/releases/download/v${CODE_SERVER_VERSION}/code-server_${CODE_SERVER_VERSION}_amd64.deb" -o /tmp/code-server.deb \
|
| 25 |
&& dpkg -i /tmp/code-server.deb \
|
| 26 |
&& rm -f /tmp/code-server.deb
|
| 27 |
|
| 28 |
+
# Python 核心依赖(精简)
|
| 29 |
RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
|
| 30 |
pip install --no-cache-dir \
|
| 31 |
+
numpy pandas scipy scikit-learn matplotlib \
|
| 32 |
+
jupyterlab ipykernel notebook \
|
| 33 |
requests httpx aiohttp pyyaml python-dotenv tqdm rich \
|
| 34 |
+
fastapi uvicorn[standard] pydantic flask \
|
| 35 |
sqlalchemy alembic psycopg2-binary redis \
|
| 36 |
+
pytest black isort ruff mypy
|
| 37 |
|
| 38 |
+
# Codex CLI
|
| 39 |
+
RUN npm install -g @openai/codex && npm cache clean --force
|
| 40 |
|
| 41 |
+
# 创建用户
|
| 42 |
RUN useradd -m -u 1000 -s /bin/bash coder \
|
| 43 |
&& echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \
|
| 44 |
&& mkdir -p /home/coder/.config/code-server /home/coder/.codex \
|
| 45 |
&& chown -R coder:coder /home/coder
|
| 46 |
|
| 47 |
+
# 快速验证 C 编译环境(构建期)
|
| 48 |
+
RUN printf '#include <stdio.h>\nint main(){puts("ok");return 0;}\n' > /tmp/t.c \
|
| 49 |
+
&& gcc /tmp/t.c -o /tmp/t \
|
| 50 |
+
&& /tmp/t | grep -q ok \
|
| 51 |
+
&& rm -f /tmp/t.c /tmp/t
|
|
|
|
| 52 |
|
| 53 |
COPY --chown=coder:coder start.sh /usr/local/bin/start.sh
|
| 54 |
RUN chmod +x /usr/local/bin/start.sh
|