Skip to content

Commit

Permalink
#5 add first couple of apps for ncsu use case - Grass and Netlogo
Browse files Browse the repository at this point in the history
  • Loading branch information
lstillwe committed Jul 14, 2017
1 parent b3447d0 commit 619a6d9
Show file tree
Hide file tree
Showing 16 changed files with 7,778 additions and 0 deletions.
99 changes: 99 additions & 0 deletions use-cases/netlogo-docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
FROM java:openjdk-7-jdk

MAINTAINER Lisa Stillwell <[email protected]>
# See https://github.com/NetLogo/NetLogo/wiki/Controlling-API

ENV NETLOGO_HOME /opt/netlogo

# Download and extract NetLogo to /opt/netlogo.
# RUN wget https://ccl.northwestern.edu/netlogo/5.2.0/netlogo-5.2.0.tar.gz && \
# tar xzf netlogo-5.2.0.tar.gz && \
# rm netlogo-5.2.0.tar.gz && \
# mv netlogo-5.2.0 $NETLOGO_HOME
RUN wget https://ccl.northwestern.edu/netlogo/5.3.1/NetLogo-5.3.1-64.tgz && \
tar xzf NetLogo-5.3.1-64.tgz && \
rm NetLogo-5.3.1-64.tgz && \
mv netlogo-5.3.1-64 $NETLOGO_HOME

ADD ./netlogo-headless.sh $NETLOGO_HOME/
RUN chmod 755 $NETLOGO_HOME/netlogo-headless.sh

# Download NetLogo extensions:
# R extension
#RUN wget "http://phoenixnap.dl.sourceforge.net/project/r-ext/v1.4 for NetLogo 5.3 and R3.2 and later/r_v1.4_for_NL5.3_R3.2_and_higher.zip" && \
RUN wget "https://iweb.dl.sourceforge.net/project/r-ext/v1.4 for NetLogo 5.3 and R 3.2 and later/r_v1.4_for_NL5.3_R3.2_and_higher.zip" && \
unzip r_v1.4_for_NL5.3_R3.2_and_higher.zip -d $NETLOGO_HOME/extensions && \
rm r_v1.4_for_NL5.3_R3.2_and_higher.zip

# pathdir extension
RUN wget https://github.com/cstaelin/Pathdir-Extension/archive/v2.0.0.zip && \
unzip v2.0.0.zip && \
cd Pathdir-Extension-2.0.0 && \
unzip pathdir.zip -d $NETLOGO_HOME/extensions && \
cd / && \
rm -rf v2.0.0.zip Pathdir-Extension-2.0.0

# Install R
RUN useradd docker \
&& mkdir /home/docker \
&& chown docker:docker /home/docker \
&& addgroup docker staff

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ed \
less \
locales \
vim-tiny \
wget \
ca-certificates \
fonts-texgyre \
&& rm -rf /var/lib/apt/lists/*

## Configure default locale, see https://github.com/rocker-org/rocker/issues/19
RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
&& locale-gen en_US.utf8 \
&& /usr/sbin/update-locale LANG=en_US.UTF-8

ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8

## Use Debian unstable via pinning -- new style via APT::Default-Release
RUN echo "deb http://http.debian.net/debian sid main" > /etc/apt/sources.list.d/debian-unstable.list \
&& echo 'APT::Default-Release;' > /etc/apt/apt.conf.d/default

#ENV R_BASE_VERSION 3.4.0
ENV R_BASE_VERSION 3.4
ENV R_HOME /usr/lib/R
ENV JRI_HOME /usr/local/lib/R/site-library/rJava/jri
ENV R_LIBS /usr/lib/R/library:/usr/lib/R/site-library:/usr/local/lib/R/site-library
ENV R_LIBS_SITE /usr/lib/R/library:/usr/lib/R/site-library:/usr/local/lib/R/site-library
ENV R_LIBS_USER /usr/lib/R/library:/usr/lib/R/site-library:/usr/local/lib/R/site-library

## Now install R and littler, and create a link for littler in /usr/local/bin
## Also set a default CRAN repo, and make sure littler knows about it too
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
littler \
r-cran-littler \
r-base=${R_BASE_VERSION}* \
r-base-dev=${R_BASE_VERSION}* \
r-recommended=${R_BASE_VERSION}* \
&& echo 'options(repos = c(CRAN = "https://cran.rstudio.com/"), download.file.method = "libcurl")' >> /etc/R/Rprofile.site \
&& echo 'source("/etc/R/Rprofile.site")' >> /etc/littler.r \
&& ln -s /usr/share/doc/littler/examples/install.r /usr/local/bin/install.r \
&& ln -s /usr/share/doc/littler/examples/install2.r /usr/local/bin/install2.r \
&& ln -s /usr/share/doc/littler/examples/installGithub.r /usr/local/bin/installGithub.r \
&& ln -s /usr/share/doc/littler/examples/testInstalled.r /usr/local/bin/testInstalled.r \
&& ln -s /usr/lib/jvm/java-7-openjdk-amd64 /usr/lib/jvm/default-java \
&& install.r docopt \
&& rm -rf /tmp/downloaded_packages/ /tmp/*.rds \
&& rm -rf /var/lib/apt/lists/*

# install package rJava
RUN /usr/local/bin/install.r rJava bnlearn readr

# For debugging
#CMD ["/bin/bash"]

ENTRYPOINT ["/opt/netlogo/netlogo-headless.sh"]
8 changes: 8 additions & 0 deletions use-cases/netlogo-docker/netlogo-headless.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
cd "`dirname "$0"`" # the copious quoting is for handling paths with spaces
# -Xmx1024m use up to 1GB RAM (edit to increase)
# -Dfile.encoding=UTF-8 ensure Unicode characters in model files are compatible cross-platform
# -classpath NetLogo.jar specify main jar
# org.nlogo.headless.Main specify we want headless, not GUI
# "$@" pass along any command line arguments
java -Xmx1024m -Dfile.encoding=UTF-8 -classpath app/NetLogo.jar org.nlogo.headless.Main "$@"
51 changes: 51 additions & 0 deletions use-cases/netlogo-docker/sample-data/BW_sm_grid.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
30.87
32.5
30.14
33.88
32.1
26.21
26.12
26.58
25.75
28.61
32.7
23.05
17.17
16.34
17.08
18.11
17.575
19.23
20.75
21.41
25.31
27.57
19.23
26.91
22.83
23.75
18.54
22.37
21.52
21.56
17.4
23.29
13.725
16.53
15.82
16.83
12.87
12.65
16.31
17.88
15.78
15.07
10.63
9.22
11.97
8.65
10.48
12.81
7.33
10.79
11.89
51 changes: 51 additions & 0 deletions use-cases/netlogo-docker/sample-data/DH_sm_grid.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
7.86
7.38
7.5
7.2
7.18
6.44
6.47
6.56
6.85
5.62
6.56
6.52
5.27
6
5.25
4.43
4.89
4.75
4.16
5.46
5.72
6.25
6
6.42
6.48
6.78
7.28
5.93
5.96
6.19
6.27
5.57
5.12
5.84
5.85
6.1
4.45
5
6.04
5.4
5.85
4.35
3.8
4.17
4.58
4.26
4.78
3.99
4.01
3.2
6.27
51 changes: 51 additions & 0 deletions use-cases/netlogo-docker/sample-data/DW_sm_grid.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
22.63
26
22.03
23.42
26.05
19.14
21.05
21.27
19.7
18.63
18.79
26.54
35.98
35.36
37.12
39.39
46.14
34.55
19.8
24.1
27.93
19.1
20.82
26.17
26
24.7
20.98
17.96
18.08
24.43
30.09
29.26
31.27
26.24
32.72
33.43
28.29
31.87
30.83
30.62
33.22
35.64
37.9
33.61
31.74
25.82
26.11
31.939
31.75
51.28
41.82
Loading

0 comments on commit 619a6d9

Please sign in to comment.