content: # Does everything except running tests...
  #
  # Stage 1 -- setup base CI environment
  #
  FROM condaforge/miniforge3:latest AS ww_env_base_ci
  LABEL Description="Base env for CI of Watershed Workflow"
  
  ARG env_name=watershed_workflow_CI
  ENV CONDA_BIN=mamba
  
  # figure out and print out conda platform info
  ARG TARGETARCH
  ARG TARGETOS
  
  RUN echo "TARGETARCH=${TARGETARCH}" && \
      echo "TARGETOS=${TARGETOS}" && \
      uname -m && \
      conda info | grep platform
  
  # copy over create_envs
  WORKDIR /ww/tmp
  COPY environments/create_envs.py /ww/tmp/create_envs.py 
  RUN mkdir environments
  
  # Create the environment
  RUN --mount=type=cache,target=/opt/conda/pkgs \
      /opt/conda/bin/python create_envs.py --OS=Linux --manager=${CONDA_BIN}  \
      --env-type=CI --with-tools-env=watershed_workflow_tools ${env_name}
  
  # test the environment
  RUN ${CONDA_BIN} run --name ${env_name} python -c "import pymetis; import geopandas"
  
  #
  # Stage 2 -- add in the pip
  #
  FROM ww_env_base_ci AS ww_env_pip_ci
  
  WORKDIR /ww/tmp
  COPY requirements.txt /ww/tmp/requirements.txt
  
  RUN ${CONDA_BIN} run --name ${env_name} python -m pip install -r requirements.txt
  
  # test the environment
  RUN ${CONDA_BIN} run --name ${env_name} python -c "import meshpy"
  
  #
  # Stage 3 -- add in Exodus
  #
  FROM ww_env_pip_ci AS ww_env_exodus_ci
  
  ENV COMPILERS=/opt/conda/envs/watershed_workflow_tools 
  ENV PATH="$COMPILERS/bin:$PATH"
  
  ENV PATH=/opt/conda/envs/watershed_workflow_tools/bin:${PATH}
  ENV SEACAS_DIR="/opt/conda/envs/${env_name}"
  ENV CONDA_PREFIX="/opt/conda/envs/${env_name}"
  
  # get the source
  WORKDIR /opt/conda/envs/${env_name}/src
  RUN git clone -b v2025-08-28 --depth=1 https://github.com/gsjaardema/seacas/ seacas
  
  # apply the patch
  COPY environments/exodus_py.patch /opt/conda/envs/${env_name}/src/exodus_py.patch
  WORKDIR /opt/conda/envs/${env_name}/src/seacas
  RUN git apply ../exodus_py.patch
  
  # configure
  WORKDIR /ww/tmp
  COPY docker/configure-seacas.sh /ww/tmp/configure-seacas.sh
  RUN chmod +x /ww/tmp/configure-seacas.sh
  WORKDIR /ww/tmp/seacas-build
  RUN ${CONDA_BIN} run -n watershed_workflow_CI ../configure-seacas.sh
  RUN make -j4 install
  
  # exodus installs its wrappers in an invalid place for python...
  # -- get and save the python version
  RUN SITE_PACKAGES=$(conda run -n ${env_name} python -c "import site; print(site.getsitepackages()[0])") && \
      cp /opt/conda/envs/${env_name}/lib/exodus3.py ${SITE_PACKAGES}
  
  # test the environment
  RUN ${CONDA_BIN} run --name ${env_name} python -c "import exodus3"
  