2020# ==============================================================================
2121
2222# --- Build Stage ---
23- FROM codercom/code-server:latest as builder
23+ # FIX: Use uppercase 'AS' for better style consistency.
24+ FROM codercom/code-server:latest AS builder
2425
2526# Set arguments for tool versions.
2627ARG MINIFORGE_VERSION=23.11.0-0
2728ARG PYTHON_VERSION=3.11
2829
2930# Define global environment variables for paths and timezone.
30- # This makes the toolchain available to ALL subsequent users (root and coder).
3131ENV CONDA_DIR=/opt/conda
3232ENV PATH=${CONDA_DIR}/bin:${PATH}
3333ENV TZ=Asia/Shanghai
@@ -50,16 +50,16 @@ RUN \
5050 && /bin/bash miniforge.sh -b -p ${CONDA_DIR} \
5151 && rm miniforge.sh \
5252 \
53- # 3. Initialize Conda for the root's shell (useful for subsequent RUN commands) .
53+ # 3. Initialize Conda for the root's shell.
5454 && conda init bash && . /root/.bashrc \
5555 \
56- # 4. Install 'uv' into the base conda environment for system-wide access .
56+ # 4. Install 'uv' into the base conda environment.
5757 && conda install -n base uv -c conda-forge -y \
5858 \
5959 # 5. Create the target Python environment.
6060 && conda create -n py${PYTHON_VERSION} python=${PYTHON_VERSION} -y \
6161 \
62- # 6. Install core libraries into the new environment using 'uv' .
62+ # 6. Install core libraries into the new environment.
6363 && uv pip install --python=${CONDA_DIR}/envs/py${PYTHON_VERSION}/bin/python \
6464 numpy \
6565 pandas \
@@ -100,11 +100,11 @@ RUN echo "Verifying root environment..." && \
100100# Final check as CODER.
101101USER coder
102102RUN echo "Verifying coder environment..." && \
103- # We must source .bashrc to load the 'conda activate' alias in a non-interactive shell.
104- source ~/.bashrc && \
103+ # ## --- [ THE FINAL FIX IS HERE ] --- ###
104+ # Use the POSIX-compliant dot ('.') instead of the bash-specific 'source'.
105+ . ~/.bashrc && \
105106 python --version && \
106107 uv --version && \
107108 echo "Coder environment check PASSED!"
108109
109110# The base image's CMD is inherited automatically.
110- # No need to specify it again.
0 commit comments