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

Fix NEST docker v2.20.2 #214

Merged
merged 3 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
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
16 changes: 5 additions & 11 deletions ci-templates/000_3.6.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,21 @@ Build_36:
rules:
- when: always
script:
# Build
- docker pull nest/nest-simulator:3.6 || true
- docker build
--cache-from nest/nest-simulator:3.6
--tag nest/nest-simulator:3.6
./src/3.6
# Simple test
# Test
- docker run -i --rm nest/nest-simulator:3.6 bash /opt/test-nest.sh
tags:
- shell-runner

Deploy_36:
stage: deploy
needs: ["Build_36"]
rules:
- when: on_success
script:
- echo -n $DOCKERHUB_REGISTRY_TOKEN | docker login -u $DOCKERHUB_REGISTRY_USER --password-stdin
# Deploy
- echo -n $DOCKERHUB_REGISTRY_TOKEN | docker login -u $DOCKERHUB_REGISTRY_USER --password-stdin
- docker push nest/nest-simulator:3.6
- docker tag nest/nest-simulator:3.6 $DOCKER_REGISTRY_IMAGE:3.6
- docker push $DOCKER_REGISTRY_IMAGE:3.6
- docker logout $DOCKERHUB_REGISTRY
- docker logout $DOCKER_REGISTRY
tags:
- shell-runner

14 changes: 4 additions & 10 deletions ci-templates/000_dev.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,18 @@ Build_Dev:
rules:
- when: always
script:
# Build
- docker pull push nest/nest-simulator:dev || true
- docker build
--cache-from nest/nest-simulator:dev
--tag nest/nest-simulator:dev
./src/dev
# Simple test
# Test
- docker run -i --rm nest/nest-simulator:dev bash /opt/test-nest.sh
tags:
- shell-runner

Deploy_Dev:
stage: deploy
needs: ["Build_Dev"]
rules:
- when: on_success
script:
# Deploy
- echo -n $DOCKERHUB_REGISTRY_TOKEN | docker login -u $DOCKERHUB_REGISTRY_USER --password-stdin
- docker push nest/nest-simulator:dev
- docker logout $DOCKERHUB_REGISTRY
tags:
- shell-runner

49 changes: 14 additions & 35 deletions ci-templates/003_2.20.2.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

131 changes: 36 additions & 95 deletions src/2.20.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM buildpack-deps:focal as builder2202
FROM ubuntu:focal
LABEL maintainer="[email protected]"

ENV TERM=xterm \
Expand All @@ -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 \
Expand All @@ -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 \
Expand All @@ -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="[email protected]"
../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"]
4 changes: 2 additions & 2 deletions src/2.20.2/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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 "$@"
Expand Down