Skip to content

Commit e090871

Browse files
committed
Add Dockerfile.
1 parent acc63e2 commit e090871

File tree

4 files changed

+98
-0
lines changed

4 files changed

+98
-0
lines changed

Dockerfile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
FROM ubuntu
2+
MAINTAINER shimamoto
3+
4+
ENV PIO_VERSION 0.11.0-v1-SNAPSHOT
5+
ENV SPARK_VERSION 1.6.3
6+
ENV ELASTICSEARCH_VERSION 1.7.6
7+
ENV HBASE_VERSION 1.0.0
8+
9+
ENV PIO_HOME /PredictionIO-${PIO_VERSION}
10+
ENV PATH=${PIO_HOME}/bin:$PATH
11+
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
12+
13+
RUN apt-get update \
14+
&& apt-get install -y --auto-remove --no-install-recommends curl git openjdk-8-jdk libgfortran3 python-pip \
15+
&& apt-get clean \
16+
&& rm -rf /var/lib/apt/lists/*
17+
18+
RUN cd / \
19+
&& git clone https://github.com/jpioug/incubator-predictionio.git \
20+
&& cd incubator-predictionio \
21+
&& ./make-distribution.sh
22+
23+
RUN tar zxvf /incubator-predictionio/PredictionIO-${PIO_VERSION}.tar.gz -C /
24+
RUN rm -r /incubator-predictionio
25+
RUN mkdir /${PIO_HOME}/vendors
26+
COPY files/pio-env.sh ${PIO_HOME}/conf/pio-env.sh
27+
28+
RUN curl -O http://d3kbcqa49mib13.cloudfront.net/spark-${SPARK_VERSION}-bin-hadoop2.6.tgz \
29+
&& tar -xvzf spark-${SPARK_VERSION}-bin-hadoop2.6.tgz -C ${PIO_HOME}/vendors \
30+
&& rm spark-${SPARK_VERSION}-bin-hadoop2.6.tgz
31+
32+
RUN curl -O https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-${ELASTICSEARCH_VERSION}.tar.gz \
33+
&& tar -xvzf elasticsearch-${ELASTICSEARCH_VERSION}.tar.gz -C ${PIO_HOME}/vendors \
34+
&& rm elasticsearch-${ELASTICSEARCH_VERSION}.tar.gz \
35+
&& echo 'cluster.name: predictionio' >> ${PIO_HOME}/vendors/elasticsearch-${ELASTICSEARCH_VERSION}/config/elasticsearch.yml \
36+
&& echo 'network.host: 127.0.0.1' >> ${PIO_HOME}/vendors/elasticsearch-${ELASTICSEARCH_VERSION}/config/elasticsearch.yml
37+
38+
RUN curl -O http://archive.apache.org/dist/hbase/hbase-${HBASE_VERSION}/hbase-${HBASE_VERSION}-bin.tar.gz \
39+
&& tar -xvzf hbase-${HBASE_VERSION}-bin.tar.gz -C ${PIO_HOME}/vendors \
40+
&& rm hbase-${HBASE_VERSION}-bin.tar.gz
41+
COPY files/hbase-site.xml ${PIO_HOME}/vendors/hbase-${HBASE_VERSION}/conf/hbase-site.xml
42+
RUN sed -i "s|VAR_PIO_HOME|${PIO_HOME}|" ${PIO_HOME}/vendors/hbase-${HBASE_VERSION}/conf/hbase-site.xml \
43+
&& sed -i "s|VAR_HBASE_VERSION|${HBASE_VERSION}|" ${PIO_HOME}/vendors/hbase-${HBASE_VERSION}/conf/hbase-site.xml

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,21 @@
11
# docker-predictionio
22
Docker container for PredictionIO-based machine learning services
3+
4+
This container uses Apache Spark, HBase and Elasticsearch.
5+
The PredictionIO version is [jpioug](https://github.com/jpioug) version.
6+
7+
### Use it interactively for development:
8+
1. First, build docker image from local Dockerfile: cd to the path containing the Dockerfile, then:
9+
```Bash
10+
$ docker build -t predictionio .
11+
```
12+
then:
13+
```Bash
14+
$ docker run -p 8000:8000 --name predictionio_instance -it predictionio /bin/bash
15+
```
16+
17+
2. Then in docker container, start all services and check they are started
18+
```Bash
19+
$ pio-start-all
20+
$ jps -l
21+
```

files/hbase-site.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<configuration>
2+
<property>
3+
<name>hbase.rootdir</name>
4+
<value>file://VAR_PIO_HOME/vendors/hbase-VAR_HBASE_VERSION/data</value>
5+
</property>
6+
<property>
7+
<name>hbase.zookeeper.property.dataDir</name>
8+
<value>VAR_PIO_HOME/vendors/zookeeper</value>
9+
</property>
10+
</configuration>

files/pio-env.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
3+
PIO_FS_BASEDIR=${HOME}/.pio_store
4+
PIO_FS_ENGINESDIR=${PIO_FS_BASEDIR}/engines
5+
PIO_FS_TMPDIR=${PIO_FS_BASEDIR}/tmp
6+
7+
SPARK_HOME=${PIO_HOME}/vendors/spark-${SPARK_VERSION}-bin-hadoop2.6
8+
9+
HBASE_CONF_DIR=${PIO_HOME}/vendors/hbase-${HBASE_VERSION}/conf
10+
11+
PIO_STORAGE_REPOSITORIES_METADATA_NAME=pio_meta
12+
PIO_STORAGE_REPOSITORIES_METADATA_SOURCE=ELASTICSEARCH
13+
PIO_STORAGE_REPOSITORIES_EVENTDATA_NAME=pio_event
14+
PIO_STORAGE_REPOSITORIES_EVENTDATA_SOURCE=HBASE
15+
PIO_STORAGE_REPOSITORIES_MODELDATA_NAME=pio_model
16+
PIO_STORAGE_REPOSITORIES_MODELDATA_SOURCE=LOCALFS
17+
18+
PIO_STORAGE_SOURCES_ELASTICSEARCH_TYPE=elasticsearch
19+
PIO_STORAGE_SOURCES_ELASTICSEARCH_CLUSTERNAME=predictionio
20+
PIO_STORAGE_SOURCES_ELASTICSEARCH_HOSTS=localhost
21+
PIO_STORAGE_SOURCES_ELASTICSEARCH_PORTS=9300
22+
PIO_STORAGE_SOURCES_ELASTICSEARCH_HOME=${PIO_HOME}/vendors/elasticsearch-${ELASTICSEARCH_VERSION}
23+
PIO_STORAGE_SOURCES_LOCALFS_TYPE=localfs
24+
PIO_STORAGE_SOURCES_LOCALFS_PATH=${PIO_FS_BASEDIR}/models
25+
PIO_STORAGE_SOURCES_HBASE_TYPE=hbase
26+
PIO_STORAGE_SOURCES_HBASE_HOME=${PIO_HOME}/vendors/hbase-${HBASE_VERSION}

0 commit comments

Comments
 (0)