From ac43cb2950a2315008929e571a1d9f3e3c474ab0 Mon Sep 17 00:00:00 2001 From: pipeacosta Date: Wed, 2 Oct 2024 14:17:05 +0200 Subject: [PATCH] Use Dockerfile.dev instead of Dockerfile Signed-off-by: pipeacosta --- Dockerfile | 21 ---------- Dockerfile.dev | 108 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+), 21 deletions(-) delete mode 100644 Dockerfile create mode 100644 Dockerfile.dev diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 31e7c18bae..0000000000 --- a/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -# sogno/dpsim:dev is built by dpsim-git/packaging/Docker/Dockerfile.dev -ARG BASE_IMAGE=sogno/dpsim:dev - -FROM ${BASE_IMAGE} - -LABEL \ - org.label-schema.schema-version = "1.0.0" \ - org.label-schema.name = "DPsim" \ - org.label-schema.license = "MPL 2.0" \ - org.label-schema.url = "http://dpsim.fein-aachen.org/" \ - org.label-schema.vcs-url = "https://github.com/sogno-platform/dpsim" - -COPY . /dpsim/ -RUN rm -rf /dpsim/build && mkdir /dpsim/build -WORKDIR /dpsim - -RUN python3 -m build --wheel -RUN python3 -m pip install ./dist/dpsim* - -EXPOSE 8888 -CMD [ "jupyter", "lab", "--ip=0.0.0.0", "--allow-root", "--no-browser", "--LabApp.token=3adaa57df44cea75e60c0169e1b2a98ae8f7de130481b5bc" ] diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 0000000000..1abf21c712 --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,108 @@ +FROM fedora:34 AS base + +LABEL \ + org.label-schema.schema-version = "1.0.0" \ + org.label-schema.name = "DPsim" \ + org.label-schema.license = "MPL 2.0" \ + org.label-schema.url = "http://dpsim.fein-aachen.org/" \ + org.label-schema.vcs-url = "https://github.com/sogno-platform/dpsim" + +RUN dnf -y update + +# Toolchain +RUN dnf -y install \ + gcc gcc-c++ clang \ + git \ + rpmdevtools rpm-build \ + make cmake pkgconfig \ + python3-pip \ + cppcheck + +# Tools needed for developement +RUN dnf -y install \ + doxygen graphviz \ + gdb \ + procps-ng + +# Dependencies +RUN dnf --refresh -y install \ + python3-devel \ + eigen3-devel \ + libxml2-devel \ + graphviz-devel \ + spdlog-devel \ + fmt-devel + +# Install some debuginfos +RUN dnf -y debuginfo-install \ + python3 + +# Build & Install sundials +RUN cd /tmp && \ + git clone --recursive https://github.com/LLNL/sundials.git && \ + mkdir -p sundials/build && cd sundials/build && \ + git checkout v3.2.1 && \ + cmake -DCMAKE_BUILD_TYPE=Release .. && \ + make -j$(nproc) install + +# CIMpp and VILLAS are installed here +ENV LD_LIBRARY_PATH="/usr/local/lib64:${LD_LIBRARY_PATH}" + +# minimal VILLAS dependencies +RUN dnf -y install \ + openssl-devel \ + libuuid-devel \ + libcurl-devel \ + jansson-devel \ + libwebsockets-devel + +# optional VILLAS dependencies +RUN dnf -y install \ + mosquitto-devel \ + libconfig-devel \ + libnl3-devel + +# Python dependencies +ADD requirements.txt . +RUN pip3 install --upgrade wheel build +RUN pip3 install -r requirements.txt + +# Install CIMpp from source +RUN cd /tmp && \ + git clone --recursive https://github.com/cim-iec/libcimpp.git && \ + mkdir -p libcimpp/build && cd libcimpp/build && \ + cmake -DCMAKE_INSTALL_LIBDIR=/usr/local/lib64 -DUSE_CIM_VERSION=CGMES_2.4.15_16FEB2016 -DBUILD_SHARED_LIBS=ON -DBUILD_ARABICA_EXAMPLES=OFF .. && make -j$(nproc) install && \ + rm -rf /tmp/libcimpp + +# Install VILLAS from source +ENV LC_ALL C.UTF-8 +ENV LANG C.UTF-8 + +RUN cd /tmp && \ + git -c submodule.fpga.update=none clone --recursive https://git.rwth-aachen.de/acs/public/villas/node.git villasnode && \ + mkdir -p villasnode/build && cd villasnode/build && \ + git -c submodule.fpga.update=none checkout b94746effb015aa98791c0e319ef11223d18e8b0 && git -c submodule.fpga.update=none submodule update --recursive && \ + cmake -DCMAKE_INSTALL_LIBDIR=/usr/local/lib64 .. && make -j$(nproc) install && \ + rm -rf /tmp/villasnode + +# Remove this part in the future and use dedicated jupyter Dockerfile +# Activate Jupyter extensions +RUN dnf -y --refresh install npm +RUN pip3 install jupyter jupyterlab jupyter_contrib_nbextensions nbconvert nbformat + +EXPOSE 8888 + +# target for vscode dev container +FROM base AS dev-vscode + +# create a non-root user for vscode to use +ARG USERNAME=dpsim +ARG USER_UID=1000 +ARG USER_GID=$USER_UID + +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ + && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ + && chmod 0440 /etc/sudoers.d/$USERNAME + +FROM base \ No newline at end of file