11# ==============================================================================
2- # Dockerfile for a professional, optimized code-server development environment
2+ # Dockerfile for a LIGHTWEIGHT, professional, and optimized code-server environment
33#
44# Features:
55# - Base: code-server (latest)
88# - Optimization (China):
99# - Timezone: Asia/Shanghai
1010# - PyPI Mirror: Alibaba Cloud (configured via uv.toml - BEST PRACTICE)
11+ # - Pre-installed Libraries: A minimal set (numpy, pandas, matplotlib)
1112# - Convenience: Auto-activates conda environment in the terminal
1213# ==============================================================================
1314
@@ -19,7 +20,6 @@ ARG MINIFORGE_VERSION=23.11.0-0
1920ARG PYTHON_VERSION=3.11
2021
2122# Step 3: Define environment variables for paths and timezone.
22- # We no longer need UV_INDEX_URL here.
2323ENV CONDA_DIR=/opt/conda
2424ENV UV_DIR=/home/coder/.local
2525ENV PATH=${CONDA_DIR}/bin:${UV_DIR}/bin:${PATH}
@@ -55,31 +55,24 @@ RUN \
5555# Step 6: Switch back to the standard, non-root 'coder' user.
5656USER coder
5757
58- # Step 7: As the 'coder' user, install 'uv', configure it via uv.toml , and create the environment.
58+ # Step 7: As the 'coder' user, install 'uv', configure it, and create the environment.
5959RUN \
6060 # Install 'uv' (the fast Python package manager).
6161 curl -LsSf https://astral.sh/uv/install.sh | sh && \
6262 \
63- # ## --- [ THE NEW AND RECOMMENDED METHOD ] --- ###
64- # Create the configuration directory for uv.
63+ # Create the configuration directory for uv and set the index-url via uv.toml.
6564 mkdir -p ~/.config/uv && \
66- # Create the uv.toml file and set the index-url.
67- # This is a persistent and official way to configure uv.
68- # The `echo -e` command allows for writing multi-line content easily.
6965 echo -e '[tool.uv]\n index-url = "https://mirrors.aliyun.com/pypi/simple"' > ~/.config/uv/uv.toml && \
7066 \
71- # Create the default conda environment using Conda's default channels .
67+ # Create the default conda environment.
7268 conda create -n py${PYTHON_VERSION} python=${PYTHON_VERSION} -y && \
7369 \
74- # Pre-install common Python packages into the new environment using 'uv'.
75- # It will now automatically use the configuration from ~/.config/uv/uv.toml .
70+ # ## --- [ MODIFICATION IS HERE ] --- ###
71+ # Pre-install a minimal set of core data science libraries .
7672 uv pip install --python=${CONDA_DIR}/envs/py${PYTHON_VERSION}/bin/python \
7773 numpy \
7874 pandas \
79- matplotlib \
80- scikit-learn \
81- jupyterlab \
82- requests && \
75+ matplotlib && \
8376 \
8477 # Configure the shell to automatically activate this environment on login.
8578 echo "conda activate py${PYTHON_VERSION}" >> ~/.bashrc
0 commit comments