Skip to content

Commit

Permalink
Migrated from miniconda to official python bullseye docker image (#3901)
Browse files Browse the repository at this point in the history
* migrated to python bullseye

* added pybamm user to sudoers

* updated docker image to python:3.12-slim-bullseye

* Apply suggestions from code review

Co-authored-by: Eric G. Kratz <[email protected]>

* Update .github/workflows/docker.yml

Co-authored-by: Arjun Verma <[email protected]>

* reverted the docker workflow

* using uv to generate venv and edited docs

---------

Co-authored-by: Eric G. Kratz <[email protected]>
Co-authored-by: Arjun Verma <[email protected]>
  • Loading branch information
3 people authored Aug 7, 2024
1 parent fa34276 commit fa68ddc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions docs/source/user_guide/installation/install-from-docker.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ If you want to build the PyBaMM Docker image locally from the PyBaMM source code
docker run -it pybamm
5. Activate PyBaMM development environment inside docker container using:
5. Activate PyBaMM development virtual environment inside docker container using:

.. code-block:: bash
conda activate pybamm
source /home/pybamm/venv/bin/activate
.. note::

Expand Down
21 changes: 11 additions & 10 deletions scripts/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM continuumio/miniconda3:latest
FROM python:3.12-slim-bullseye
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv

WORKDIR /

Expand All @@ -21,17 +22,17 @@ ENV CMAKE_CXX_COMPILER=/usr/bin/g++
ENV CMAKE_MAKE_PROGRAM=/usr/bin/make
ENV LD_LIBRARY_PATH=/home/pybamm/.local/lib

RUN conda create -n pybamm python=3.11
RUN conda init --all
SHELL ["conda", "run", "-n", "pybamm", "/bin/bash", "-c"]
RUN conda install -y pip
# Create a virtual environment
ENV VIRTUAL_ENV=/home/pybamm/venv
RUN uv venv $VIRTUAL_ENV
RUN #!/bin/bash && source /home/pybamm/venv/bin/activate;
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

RUN pip install --upgrade --user pip setuptools wheel wget
RUN pip install cmake
RUN uv pip install --upgrade setuptools wheel wget cmake

RUN python scripts/install_KLU_Sundials.py && \
rm -rf pybind11 && \
git clone https://github.com/pybind/pybind11.git && \
pip install --user -e ".[all,dev,docs,jax]";
rm -rf pybind11 && \
git clone https://github.com/pybind/pybind11.git && \
uv pip install -e ".[all,dev,docs,jax]";

ENTRYPOINT ["/bin/bash"]

0 comments on commit fa68ddc

Please sign in to comment.