Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrated from miniconda to official python bullseye docker image #3901

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 16 additions & 42 deletions scripts/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
FROM continuumio/miniconda3:latest
FROM python:3.11-slim-bullseye

WORKDIR /

# Install the necessary dependencies
RUN apt-get update && apt-get -y upgrade
RUN apt-get install -y libopenblas-dev gcc gfortran graphviz git make g++ build-essential cmake pandoc texlive-latex-extra dvipng
RUN apt-get install -y libopenblas-dev gcc gfortran graphviz git make g++ build-essential cmake pandoc texlive-latex-extra dvipng sudo
RUN rm -rf /var/lib/apt/lists/*

RUN useradd -m -s /bin/bash pybamm
RUN useradd -m -s /bin/bash pybamm && echo "pybamm:pybamm" | chpasswd && adduser pybamm sudo
RUN usermod -ou 1000 -g 0 pybamm
USER pybamm

WORKDIR /home/pybamm/
Expand All @@ -23,47 +24,20 @@ ENV CMAKE_MAKE_PROGRAM=/usr/bin/make
ENV SUNDIALS_INST=/home/pybamm/.local
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
# Migrating to venv and create a virtual environment for python 3.11
ENV VIRTUAL_ENV=/home/pybamm/venv
RUN python3.11 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

ARG IDAKLU
ARG ODES
ARG JAX
ARG ALL
RUN pip install --upgrade setuptools wheel wget && \
pip install cmake
RUN #!/bin/bash && \
source /home/pybamm/venv/bin/activate;

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

RUN if [ "$IDAKLU" = "true" ]; then \
python scripts/install_KLU_Sundials.py && \
rm -rf pybind11 && \
git clone https://github.com/pybind/pybind11.git && \
pip install --user -e ".[all,dev,docs]"; \
fi

RUN if [ "$ODES" = "true" ]; then \
python scripts/install_KLU_Sundials.py && \
pip install --user -e ".[all,dev,docs,odes]"; \
fi

RUN if [ "$JAX" = "true" ]; then \
pip install --user -e ".[all,dev,docs,jax]"; \
fi

RUN if [ "$ALL" = "true" ]; then \
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,odes]"; \
fi

RUN if [ -z "$IDAKLU" ] \
&& [ -z "$ODES" ] \
&& [ -z "$JAX" ] \
&& [ -z "$ALL" ]; then \
pip install --user -e ".[all,dev,docs]"; \
fi

ENTRYPOINT ["/bin/bash"]