Skip to content

Commit 7287061

Browse files
authored
Merge pull request #89 from MetaCell/refactor-dockerimage
Refactor dockerimage
2 parents 693bf76 + 07806a9 commit 7287061

3 files changed

Lines changed: 13 additions & 100 deletions

File tree

Dockerfile

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,6 @@
1-
FROM jupyter/base-notebook:eb70bcf1a292
2-
USER root
3-
4-
RUN apt-get -qq update
5-
RUN apt-get install -y \
6-
locales \
7-
wget \
8-
gcc \
9-
g++ \
10-
build-essential \
11-
libncurses-dev \
12-
libpython-dev \
13-
cython \
14-
libx11-dev \
15-
git \
16-
bison \
17-
flex \
18-
automake \
19-
libtool \
20-
libxext-dev \
21-
libncurses-dev \
22-
xfonts-100dpi \
23-
libopenmpi-dev \
24-
make \
25-
zlib1g-dev \
26-
unzip \
27-
vim \
28-
libpng-dev
29-
1+
FROM metacell/jupyter-neuron:latest
302
# Switch to non sudo, create a Python 3 virtual environment
313
USER $NB_USER
32-
RUN conda create --name snakes python=3.7
33-
34-
# Install latest iv and NEURON
35-
RUN git clone --branch 7.6.2 https://github.com/neuronsimulator/nrn
36-
WORKDIR nrn
37-
RUN ./build.sh
38-
# Activate conda to configure nrn with the right python version
39-
RUN /bin/bash -c "source activate snakes && ./configure --without-x --with-nrnpython=python3 --without-paranrn --prefix='/home/jovyan/work/nrn/' --without-iv"
40-
RUN make --silent -j4
41-
RUN make --silent install -j4
42-
43-
# Install NEURON python
44-
WORKDIR src/nrnpython
45-
ENV PATH="/home/jovyan/work/nrn/x86_64/bin:${PATH}"
46-
RUN /bin/bash -c "source activate snakes && python setup.py install"
474

485
ARG INCUBATOR_VER=unknown
496
RUN /bin/bash -c "INCUBATOR_VER=${INCUBATOR_VER} source activate snakes && pip install netpyne_ui"

Dockerfile_dev

Lines changed: 4 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,14 @@
1-
FROM jupyter/base-notebook:eb70bcf1a292
2-
USER root
1+
FROM metacell/jupyter-neuron:latest
2+
USER $NB_USER
33

44
ARG netpyneuiBranch=development
55
ENV netpyneuiBranch=${netpyneuiBranch}
66
RUN echo "$netpyneuiBranch";
77

8-
RUN apt-get -qq update
9-
RUN apt-get install -y \
10-
locales \
11-
wget \
12-
gcc \
13-
g++ \
14-
build-essential \
15-
libncurses-dev \
16-
libpython-dev \
17-
cython \
18-
libx11-dev \
19-
git \
20-
bison \
21-
flex \
22-
automake \
23-
libtool \
24-
libxext-dev \
25-
libncurses-dev \
26-
xfonts-100dpi \
27-
libopenmpi-dev \
28-
make \
29-
zlib1g-dev \
30-
unzip \
31-
vim \
32-
libpng-dev
33-
34-
# Switch to non sudo, create a Python 3 virtual environment
35-
USER $NB_USER
36-
RUN conda create --name snakes python=3.7
37-
38-
# Install latest iv and NEURON
39-
RUN git clone --branch 7.6.2 https://github.com/neuronsimulator/nrn
40-
WORKDIR nrn
41-
RUN ./build.sh
42-
# Activate conda to configure nrn with the right python version
43-
RUN /bin/bash -c "source activate snakes && ./configure --without-x --with-nrnpython=python3 --without-paranrn --prefix='/home/jovyan/work/nrn/' --without-iv"
44-
RUN make --silent -j4
45-
RUN make --silent install -j4
46-
47-
48-
# Install NEURON python
49-
WORKDIR src/nrnpython
50-
ENV PATH="/home/jovyan/work/nrn/x86_64/bin:${PATH}"
51-
RUN /bin/bash -c "source activate snakes && python setup.py install"
52-
538
# Clone NetPyNE-UI and install the development version
54-
WORKDIR ../../../
55-
RUN wget https://github.com/MetaCell/NetPyNE-UI/archive/$netpyneuiBranch.zip
9+
RUN wget https://github.com/MetaCell/NetPyNE-UI/archive/$netpyneuiBranch.zip -q
5610
RUN unzip $netpyneuiBranch.zip
57-
WORKDIR NetPyNE-UI-$netpyneuiBranch/utilities
11+
WORKDIR /home/jovyan/work/NetPyNE-UI-$netpyneuiBranch/utilities
5812
RUN /bin/bash -c "source activate snakes && python --version"
5913
RUN /bin/bash -c "source activate snakes && exec python install.py branch $netpyneuiBranch"
6014
WORKDIR /home/jovyan

utilities/install.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ def clone(repository, folder, default_branch, cwdp='', recursive = False, destin
1616
subprocess.call(['git', 'clone', '--recursive', repository], cwd='./'+cwdp)
1717
else:
1818
if destination_folder:
19-
subprocess.call(['git', 'clone', repository, destination_folder], cwd='./'+cwdp)
19+
subprocess.call(['git', 'clone', repository, destination_folder], cwd='./'+cwdp)
2020
else:
21-
subprocess.call(['git', 'clone', repository], cwd='./'+cwdp)
21+
subprocess.call(['git', 'clone', repository], cwd='./'+cwdp)
2222
checkout(folder, default_branch, cwdp)
2323

2424
def checkout(folder, default_branch, cwdp):
@@ -29,7 +29,7 @@ def checkout(folder, default_branch, cwdp):
2929
os.chdir(newPath)
3030
python_git=subprocess.Popen("git branch -a",shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
3131
outstd,errstd=python_git.communicate()
32-
if branch and branch in str(outstd):
32+
if branch and branch in str(outstd) and branch != 'development': # don't ckeckout development for netpyne
3333
subprocess.call(['git', 'checkout', branch], cwd='./')
3434
else:
3535
subprocess.call(['git', 'checkout', default_branch], cwd='./')
@@ -39,7 +39,7 @@ def main(argv):
3939
global branch
4040
if(len(argv) > 0):
4141
if(argv[0] == 'branch'):
42-
branch = argv[1]
42+
branch = argv[1]
4343

4444
if __name__ == "__main__":
4545
main(sys.argv[1:])
@@ -53,7 +53,8 @@ def main(argv):
5353
subprocess.call(['pip', 'install', '-e', '.'], cwd='./netpyne/')
5454

5555
clone('https://github.com/openworm/org.geppetto.frontend.jupyter.git','org.geppetto.frontend.jupyter','development')
56-
subprocess.call(['npm', 'install'], cwd='./org.geppetto.frontend.jupyter/js')
56+
with open('npm_frontend_jupyter_log', 'a') as stdout:
57+
subprocess.call(['npm', 'install'], cwd='./org.geppetto.frontend.jupyter/js', stdout=stdout)
5758
subprocess.call(['npm', 'run', 'build-dev'], cwd='./org.geppetto.frontend.jupyter/js')
5859

5960
# We can't clone org.geppetto.frontend as a regular submodule because Travis doesn't have .gitmodules in the zip
@@ -67,7 +68,8 @@ def main(argv):
6768

6869
# Installing and building
6970
print("NPM Install and build for Geppetto Frontend ...")
70-
subprocess.call(['npm', 'install'], cwd='./netpyne_ui/geppetto/src/main/webapp/')
71+
with open('npm_frontend_log', 'a') as stdout:
72+
subprocess.call(['npm', 'install'], cwd='./netpyne_ui/geppetto/src/main/webapp/', stdout=stdout)
7173
subprocess.call(['npm', 'run', 'build-dev-noTest'], cwd='./netpyne_ui/geppetto/src/main/webapp/')
7274

7375
print("Installing jupyter_geppetto python package ...")

0 commit comments

Comments
 (0)