From 12d6eeb58960e04e81f3ec7d11add7cec7b46e01 Mon Sep 17 00:00:00 2001 From: Steffen Graber Date: Wed, 6 Mar 2024 09:34:59 +0100 Subject: [PATCH] Fix NEST docker v2.20.2 (#214) * Merge build and deploy to fix deploy problems * Rework nest build (no boost, music) * Update workflow and activate in CI build --- ci-templates/003_2.20.2.gitlab-ci.yml | 49 +++------- src/2.20.2/Dockerfile | 131 +++++++------------------- src/2.20.2/entrypoint.sh | 4 +- 3 files changed, 52 insertions(+), 132 deletions(-) diff --git a/ci-templates/003_2.20.2.gitlab-ci.yml b/ci-templates/003_2.20.2.gitlab-ci.yml index 06f5c76..fdb0c21 100644 --- a/ci-templates/003_2.20.2.gitlab-ci.yml +++ b/ci-templates/003_2.20.2.gitlab-ci.yml @@ -2,49 +2,28 @@ ### v2.20.2 ### ############################################### + Build_2202: stage: build needs: ["Build_Base"] rules: - - when: never + - when: always script: - - docker pull $DOCKER_REGISTRY_IMAGE:2.20.2 || true - - docker build - --cache-from $DOCKER_REGISTRY_IMAGE:2.20.2 - --tag $DOCKER_REGISTRY_IMAGE:2.20.2.$CI_PIPELINE_ID + # Build + - docker pull nest/nest-simulator:2.20.2 || true + - docker build + --cache-from nest/nest-simulator:2.20.2 + --tag nest/nest-simulator:2.20.2 ./src/2.20.2 - - docker push $DOCKER_REGISTRY_IMAGE:2.20.2.$CI_PIPELINE_ID - tags: - - shell-runner - -Test_2202: - stage: test - needs: ["Build_2202"] - rules: - - when: never - script: - - docker pull $DOCKER_REGISTRY_IMAGE:2.20.2.$CI_PIPELINE_ID - - docker stop $(docker ps -q) 2>/dev/null || true - - docker rm -f $(docker ps -aq) 2>/dev/null || true - - docker ps - - docker run -i -d --rm -e NEST_CONTAINER_MODE=nest-server -p 5000:5000 - --name $CI_PIPELINE_ID $DOCKER_REGISTRY_IMAGE:2.20.2.$CI_PIPELINE_ID - - docker ps - tags: - - shell-runner - -Deploy_2202: - stage: deploy - needs: ["Test_2202"] - rules: - - when: never - script: - - docker pull $DOCKER_REGISTRY_IMAGE:2.20.2.$CI_PIPELINE_ID - - docker tag $DOCKER_REGISTRY_IMAGE:2.20.2.$CI_PIPELINE_ID $DOCKER_REGISTRY_IMAGE:2.20.2 - - docker push $DOCKER_REGISTRY_IMAGE:2.20.2 + # Test + - docker run -i --rm nest/nest-simulator:2.20.2 bash /opt/test-nest.sh + # Deploy - echo -n $DOCKERHUB_REGISTRY_TOKEN | docker login -u $DOCKERHUB_REGISTRY_USER --password-stdin - - docker tag $DOCKER_REGISTRY_IMAGE:2.20.2 nest/nest-simulator:2.20.2 - docker push nest/nest-simulator:2.20.2 + - docker tag nest/nest-simulator:2.20.2 $DOCKER_REGISTRY_IMAGE:2.20.2 + - docker push $DOCKER_REGISTRY_IMAGE:2.20.2 - docker logout $DOCKERHUB_REGISTRY + - docker logout $DOCKER_REGISTRY tags: - shell-runner + diff --git a/src/2.20.2/Dockerfile b/src/2.20.2/Dockerfile index 6d47c46..83f01bf 100644 --- a/src/2.20.2/Dockerfile +++ b/src/2.20.2/Dockerfile @@ -1,4 +1,4 @@ -FROM buildpack-deps:focal as builder2202 +FROM ubuntu:focal LABEL maintainer="s.graber@fz-juelich.de" ENV TERM=xterm \ @@ -8,9 +8,12 @@ ENV TERM=xterm \ RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential libtool automake autotools-dev libreadline8 libreadline-dev freeglut3-dev \ gosu \ + curl \ cmake \ cython3 \ jq \ + jupyter-notebook \ + less \ libboost-filesystem-dev \ libboost-regex-dev \ libboost-wave-dev \ @@ -27,12 +30,17 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libpcre3-dev \ libpython3.8 \ llvm-dev \ + nano \ openmpi-bin \ + openssh-client \ + openssh-server \ pandoc \ pep8 \ python3-dev \ + python3-flask \ + python3-flask-cors \ + python3-restrictedpython \ python3-ipython \ - python3-jupyter-core \ python3-matplotlib \ python3-mpi4py \ python3-nose \ @@ -49,114 +57,47 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ vera++ \ wget && \ apt-get autoremove -y && \ - rm -rf /var/lib/apt/lists/* && \ - # update-alternatives --remove-all python && \ - update-alternatives --install /usr/bin/python python /usr/bin/python3 10 && \ - update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 10 && \ - python3 -m pip install --upgrade pip setuptools wheel mock - - -# Install music -RUN wget https://github.com/INCF/MUSIC/archive/master.tar.gz && \ - tar -zxf master.tar.gz && \ - mkdir music-build music-install && \ - cd MUSIC-master && \ - sh ./autogen.sh && \ - cd ../music-build && \ - ../MUSIC-master/configure --prefix=/opt/music-install && \ - make && \ - make install && \ - cd / && \ - rm master.tar.gz + rm -rf /var/lib/apt/lists/* +# # Install music +# RUN wget https://github.com/INCF/MUSIC/archive/master.tar.gz && \ +# tar -zxf master.tar.gz && \ +# mkdir music-build music-install && \ +# cd MUSIC-master && \ +# sh ./autogen.sh && \ +# cd ../music-build && \ +# ../MUSIC-master/configure --prefix=/opt/music-install && \ +# make && \ +# make install && \ +# cd / && \ +# rm master.tar.gz # Install NEST RUN wget https://github.com/nest/nest-simulator/archive/refs/tags/v2.20.2.tar.gz && \ - mkdir nest-build && \ + mkdir /nest-build && \ tar zxf v2.20.2.tar.gz && \ - cd nest-build && \ + cd /nest-build && \ cmake -DCMAKE_INSTALL_PREFIX:PATH=/opt/nest/ \ - -Dwith-warning=ON \ - -Dwith-boost=ON \ - -Dwith-ltdl=ON \ - -Dwith-gsl=ON \ - -Dwith-readline=ON \ - -Dwith-python=ON \ + -Dwith-python=3 \ -Dwith-mpi=ON \ -Dwith-openmp=ON \ - -Dwith-libneurosim=OFF \ - -Dwith-music=/opt/music-install \ - ../nest-simulator-2.20.2 && \ - make -RUN cd nest-build && make install - - -############################################################################### - -FROM ubuntu:focal -LABEL maintainer="s.graber@fz-juelich.de" + ../nest-simulator-2.20.2 &&\ + make && make install -ENV TERM=xterm \ - TZ=Europe/Berlin \ - DEBIAN_FRONTEND=noninteractive - -RUN apt-get update && apt-get install -y --no-install-recommends \ - build-essential \ - curl \ - libpcre3 \ - libpcre3-dev \ - gosu \ - jupyter-notebook \ - less \ - libgomp1 \ - libgsl-dev \ - libltdl7 \ - libopenmpi-dev \ - libomp-dev \ - libpython3.8 \ - nano \ - openmpi-bin \ - openssh-client \ - openssh-server \ - python3-dev \ - python3-flask \ - python3-flask-cors \ - python3-restrictedpython \ - python3-matplotlib \ - python3-mpi4py \ - python3-numpy \ - python3-pip \ - python3-scipy \ - python3-setuptools \ - python3-pandas \ - python3-sympy \ - python3-tk \ - wget && \ - apt-get autoremove -y && \ - rm -rf /var/lib/apt/lists/* && \ - update-alternatives --install /usr/bin/python python /usr/bin/python3 10 && \ - update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 10 && \ - python3 -m pip install quantities lazyarray neo && \ - python3 -m pip install uwsgi &&\ - # wget https://github.com/NeuralEnsemble/PyNN/archive/nest-dev.tar.gz && \ - # tar -xzf nest-dev.tar.gz && \ - # cd PyNN-nest-dev && \ - # python3 setup.py install && \ - # cd .. && rm -rf PyNN-nest-dev && rm nest-dev.tar.gz - python3 -m pip install --no-binary :all: PyNN && \ - python3 -m pip install Flask --user && \ - python3 -m pip install Flask-cors --user && \ - python3 -m pip install RestrictedPython --user && \ +RUN python3 -m pip install --upgrade pip setuptools wheel mock --user &&\ + python3 -m pip install quantities lazyarray neo --user && \ + python3 -m pip install uwsgi --user &&\ + python3 -m pip install PyNN --user && \ + python3 -m pip install Flask --user && \ + python3 -m pip install Flask-cors --user && \ + python3 -m pip install RestrictedPython --user && \ python3 -m pip install nest-desktop --user &&\ python3 -m pip install uwsgi --user &&\ - python3 -m pip install jupyterlab --user &&\ python3 -m pip install nestml --user -COPY --from=builder2202 /opt/nest /opt/nest -COPY --from=builder2202 /opt/music-install /opt/music-install +RUN python3 -m pip install jupyterlab --user COPY entrypoint.sh /usr/local/bin/entrypoint.sh RUN chmod +x /usr/local/bin/entrypoint.sh - EXPOSE 5000 8000 8080 ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] diff --git a/src/2.20.2/entrypoint.sh b/src/2.20.2/entrypoint.sh index b742890..cd38c75 100644 --- a/src/2.20.2/entrypoint.sh +++ b/src/2.20.2/entrypoint.sh @@ -6,7 +6,7 @@ IP_ADDRESS=$(hostname --ip-address) source /opt/nest/bin/nest_vars.sh # Running NEST to test and to copy the .nestrc into /home/nest -nest --help +#nest --help export MUSIC_ROOT_DIR=/opt/music-install export MUSIC_ROOT=${MUSIC_ROOT_DIR} @@ -31,7 +31,7 @@ elif [[ "${MODE}" = 'jupyterlab' ]]; then elif [[ "${MODE}" = 'notebook' ]]; then mkdir -p /opt/data; cd /opt/data - exec jupyter-notebook --ip="${IP_ADDRESS}" --port=8080 --no-browser --allow-root + exec /root/.local/bin/jupyter-notebook --ip="${IP_ADDRESS}" --port=8080 --no-browser --allow-root else exec "$@"