forked from apache/predictionio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_docker.sh
executable file
·66 lines (56 loc) · 2.19 KB
/
build_docker.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
docker pull predictionio/pio-testing-base
pushd $DIR/..
source conf/pio-vendors.sh
if [ ! -f $DIR/docker-files/${PGSQL_JAR} ]; then
wget $PGSQL_DOWNLOAD
mv ${PGSQL_JAR} $DIR/docker-files/
fi
if [ ! -f $DIR/docker-files/${SPARK_ARCHIVE} ]; then
curl -fLo $SPARK_ARCHIVE $SPARK_DOWNLOAD_MIRROR
if [[ $? -ne 0 ]]; then
curl -fLo $SPARK_ARCHIVE $SPARK_DOWNLOAD_ARCHIVE
fi
mv $SPARK_ARCHIVE $DIR/docker-files/
fi
set -e
./make-distribution.sh \
-Dscala.version=$PIO_SCALA_VERSION \
-Dspark.version=$PIO_SPARK_VERSION \
-Dhadoop.version=$PIO_HADOOP_VERSION \
-Delasticsearch.version=$PIO_ELASTICSEARCH_VERSION \
-Dhbase.version=$PIO_HBASE_VERSION
sbt/sbt clean storage/clean
assembly_folder=assembly/src/universal/lib
rm -rf ${assembly_folder}/*.jar
rm -rf ${assembly_folder}/spark
mkdir -p ${assembly_folder}/spark
cp dist/lib/*.jar ${assembly_folder}
cp dist/lib/spark/*.jar ${assembly_folder}/spark
rm *.tar.gz
docker build -t predictionio/pio .
popd
docker build -t predictionio/pio-testing $DIR \
--build-arg SPARK_ARCHIVE=$SPARK_ARCHIVE \
--build-arg SPARK_DIR=$SPARK_DIR \
--build-arg PGSQL_JAR=$PGSQL_JAR \
--build-arg PIO_SCALA_VERSION=$PIO_SCALA_VERSION \
--build-arg PIO_SPARK_VERSION=$PIO_SPARK_VERSION \
--build-arg PIO_HADOOP_VERSION=$PIO_HADOOP_VERSION \
--build-arg PIO_ELASTICSEARCH_VERSION=$PIO_ELASTICSEARCH_VERSION