Skip to content
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
24 changes: 24 additions & 0 deletions .github/workflows/docker-image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,30 @@ jobs:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

build-2-20-2:
runs-on: ubuntu-2404
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Build 2.20.2 Docker image
run: |
docker build ./src/2.20.2 --tag nest/nest-simulator:2.20.2

- name: Check NEST 2.20.2
run: |
docker run --rm nest/nest-simulator:2.20.2 python3 -c "import nest" | grep "Version:"

- name: Push 2.20.2 to Docker Hub
uses: docker/build-push-action@v5
with:
context: ./src/2.20.2
push: true
tags: nest/nest-simulator:2.20.2
env:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

build-3-9:

runs-on: ubuntu-2404
Expand Down
147 changes: 51 additions & 96 deletions src/2.20.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,103 +1,58 @@
FROM ubuntu:focal
LABEL maintainer="s.graber@fz-juelich.de"
FROM ubuntu:22.04

ENV TERM=xterm \
TZ=Europe/Berlin \
DEBIAN_FRONTEND=noninteractive
ENV DEBIAN_FRONTEND=noninteractive

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 \
libboost-program-options-dev \
libboost-test-dev \
libgomp1 \
libgsl-dev \
libltdl7 \
libltdl-dev \
libmusic1v5 \
libopenmpi-dev \
libomp-dev \
libpcre3 \
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-matplotlib \
python3-mpi4py \
python3-nose \
python3-numpy \
python3-pandas \
python3-path \
python3-pip \
python3-scipy \
python3-setuptools \
python3-sphinx \
python3-statsmodels \
python3-tk \
python-dev \
vera++ \
wget && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential cmake git wget ca-certificates pkg-config \
ipython3 python3-dev python3-pip python3-setuptools python3-venv python3-six python3-numpy \
gfortran libgsl-dev libreadline-dev libncurses-dev libblas-dev liblapack-dev \
openmpi-bin libopenmpi-dev libboost-all-dev swig libtool autoconf automake \
zlib1g-dev libjemalloc-dev \
&& 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
# create isolated python virtual environment and install required pip packages
RUN python3 -m venv /opt/venv \
&& /opt/venv/bin/pip install --upgrade pip \
&& /opt/venv/bin/pip install --force-reinstall --no-cache-dir numpy cython==0.29.36 six scipy jupyter nestml \
&& rm -rf /var/lib/apt/lists/*

# Install NEST
RUN wget https://github.com/nest/nest-simulator/archive/refs/tags/v2.20.2.tar.gz && \
mkdir /nest-build && \
tar zxf v2.20.2.tar.gz && \
cd /nest-build && \
cmake -DCMAKE_INSTALL_PREFIX:PATH=/opt/nest/ \
-Dwith-python=3 \
-Dwith-mpi=ON \
-Dwith-openmp=ON \
../nest-simulator-2.20.2 &&\
make && make install
WORKDIR /opt

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 nestml --user
# ensure MPI compilers are used by CMake
ENV CC=/usr/bin/mpicc
ENV CXX=/usr/bin/mpicxx

RUN python3 -m pip install jupyterlab --user
# Download NEST 2.20.2 source and build
RUN wget -O nest-2.20.2.tar.gz https://github.com/nest/nest-simulator/archive/refs/tags/v2.20.2.tar.gz \
&& tar xzf nest-2.20.2.tar.gz \
&& mv nest-simulator-2.20.2 nest \
# Workaround: Remove lines with '/time 0.0' from test_noise_generator.sli to avoid known test failures in some environments
&& sed -i '/\/time 0.0/d' /opt/nest/testsuite/unittests/test_noise_generator.sli \
&& mkdir -p nest/build \
&& cd nest/build \
&& cmake .. -DCMAKE_INSTALL_PREFIX=/opt/nest -DCMAKE_INSTALL_LIBDIR=lib \
-Dwith-python=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 -DCYTHON_EXECUTABLE=/opt/venv/bin/cython \
-Dwith-mpi=ON -Dwith-openmp=ON -Dwith-gsl=/usr \
-Dwith-hdf5=OFF -Dstatic-libraries=OFF -Dwith-boost=ON \
&& make -j"$(nproc)" \
&& make install \
&& ldconfig

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"]
ENV VIRTUAL_ENV=/opt/venv
ENV PATH="/opt/venv/bin:/opt/nest/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
ENV LD_LIBRARY_PATH="/opt/nest/lib:${LD_LIBRARY_PATH}"
ENV PYTHONPATH="/opt/nest/lib/python3.10/site-packages:${PYTHONPATH}"
ENV NEST_INSTALL_DIR=/opt/nest
# Allow OpenMPI/mpirun to run as root (needed for Docker test/CI)
ENV OMPI_ALLOW_RUN_AS_ROOT=1
ENV OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1

# Sanity check during build (image will still build even if this fails)
RUN if command -v nest-config >/dev/null 2>&1; then nest-config --version; else echo "nest-config not found"; fi

# Ensure entrypoint.sh is executable
COPY entrypoint.sh /opt/entrypoint.sh
RUN chmod +x /opt/entrypoint.sh

ENTRYPOINT ["/opt/entrypoint.sh"]
19 changes: 1 addition & 18 deletions src/2.20.2/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,16 @@ IP_ADDRESS=$(hostname --ip-address)
# NEST environment
source /opt/nest/bin/nest_vars.sh

# Running NEST to test and to copy the .nestrc into /home/nest
#nest --help

export MUSIC_ROOT_DIR=/opt/music-install
export MUSIC_ROOT=${MUSIC_ROOT_DIR}
MUSIC_PATH=${MUSIC_ROOT_DIR}
export LD_LIBRARY_PATH=${MUSIC_PATH}/lib:$LD_LIBRARY_PATH
export PATH=${MUSIC_PATH}/bin:$PATH
export CPATH=${MUSIC_PATH}/include:$CPATH
export PYTHONPATH=${MUSIC_PATH}/lib/python3.8/site-packages:$PYTHONPATH


MODE="${NEST_CONTAINER_MODE:-$1}"
if [[ "${MODE}" = 'interactive' ]]; then
read -p "Your python script: " name
echo Starting: $name
# Start
mkdir -p /opt/data; cd /opt/data
exec python3 /opt/data/$name

# elif [[ "${MODE}" = 'jupyterlab' ]]; then
# mkdir -p /opt/data; cd /opt/data
# exec /root/.local/bin/jupyter lab --ip="${IP_ADDRESS}" --port=8080 --no-browser --allow-root

elif [[ "${MODE}" = 'notebook' ]]; then
mkdir -p /opt/data; cd /opt/data
exec /root/.local/bin/jupyter notebook --ip="${IP_ADDRESS}" --port=8080 --no-browser --allow-root
exec jupyter notebook --ip="${IP_ADDRESS}" --port=8080 --no-browser --allow-root

else
exec "$@"
Expand Down
Loading