Skip to content

Commit f33886c

Browse files
committed
Docker: Add Docker support
Signed-off-by: Ce Gao <ce.gao@outlook.com>
1 parent e13c10c commit f33886c

File tree

8 files changed

+98
-104
lines changed

8 files changed

+98
-104
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env bash
2+
3+
# init.sh establishes a initial environment to build Processing.R in travis.
4+
# Most of the code is copied from `scripts/generate-ant-file.sh`
5+
6+
# Timestamped log, e.g. log "cluster created".
7+
#
8+
# Input:
9+
# $1 Log string.
10+
function log {
11+
echo -e "[`TZ=Asia/Shanghai date`] ${1}"
12+
}
13+
14+
root=$(dirname "${BASH_SOURCE}")/..
15+
16+
# Paths
17+
# Those paths are not needed when building runner.jar,
18+
# but will be used in the future to package the mode.
19+
modes="/mock-user/modes"
20+
executable="/mock-user/Processing"
21+
# Those paths are important to build runner.jar.
22+
processing="/code/processing"
23+
core="/code/processing/core/library/"
24+
pde="/code/processing/lib/"
25+
renjin="lib/renjin-script-engine-0.8.2194-jar-with-dependencies.jar"
26+
27+
cd ${root}
28+
cp build.xml.template build.xml
29+
# Interpret config template.
30+
log "Inject the config to build.xml.template"
31+
perl -i -pe "s|\@\@modes\@\@|${modes}|g" build.xml
32+
perl -i -pe "s|\@\@executable\@\@|${executable}|g" build.xml
33+
perl -i -pe "s|\@\@processing\@\@|${processing}|g" build.xml
34+
perl -i -pe "s|\@\@core\@\@|${core}|g" build.xml
35+
perl -i -pe "s|\@\@pde\@\@|${pde}|g" build.xml
36+
perl -i -pe "s|\@\@renjin\@\@|${renjin}|g" build.xml
37+
cd - > /dev/null

.docker/run-examples.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
# Timestamped log, e.g. log "cluster created".
4+
#
5+
# Input:
6+
# $1 Log string.
7+
function log {
8+
echo -e "[`TZ=Asia/Shanghai date`] ${1}"
9+
}
10+
11+
root=$(dirname "${BASH_SOURCE}")/..
12+
13+
cd ${root}
14+
java -jar /code/runner/RLangMode.jar examples/test-draw.R
15+
cd - > /dev/null

Dockerfile

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
FROM consol/ubuntu-xfce-vnc
2+
MAINTAINER Ce Gao(gaocegege) <gaocegege@hotmail.com>
3+
4+
RUN mkdir -p /code/runner
5+
6+
# Install base package.
7+
RUN apt-get update && \
8+
apt-get install -y \
9+
curl \
10+
ant
11+
12+
# Download Processing.
13+
RUN curl -L http://download.processing.org/processing-3.3-linux64.tgz > /code/processing.tgz && \
14+
tar xvf /code/processing.tgz -C /code && \
15+
mv /code/processing-3.3 /code/processing && \
16+
rm -rf /code/processing.tgz
17+
18+
# Install Oracle JDK 1.8
19+
RUN echo "===> add webupd8 repository..." && \
20+
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list && \
21+
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list && \
22+
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886 && \
23+
apt-get update && \
24+
echo "===> install Java" && \
25+
echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
26+
echo debconf shared/accepted-oracle-license-v1-1 seen true | debconf-set-selections && \
27+
DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes oracle-java8-installer oracle-java8-set-default && \
28+
echo "===> clean up..." && \
29+
rm -rf /var/cache/oracle-jdk8-installer && \
30+
apt-get clean && \
31+
rm -rf /var/lib/apt/lists/*
32+
33+
# Set Java Environment Varibales
34+
ENV JAVA_VERSION 8u121
35+
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle
36+
# VNC Settings
37+
# VNC_PW should < 8 characters.
38+
ENV VNC_PW process
39+
40+
COPY . /code/processing.r
41+
WORKDIR /code/processing.r
42+
43+
# Build Runner.jar
44+
RUN bash .docker/generate-ant-file-in-docker.sh && \
45+
ant try && \
46+
mv try/RLangMode.jar /code/runner

build.xml

Lines changed: 0 additions & 104 deletions
This file was deleted.

0 commit comments

Comments
 (0)