You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2015/07/07 08:50:37 UTC

[05/50] incubator-ignite git commit: #IGNITE-1046 Added dockerfile and scripts for running container with ignite.

#IGNITE-1046 Added dockerfile and scripts for running container with ignite.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/9de7d248
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9de7d248
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9de7d248

Branch: refs/heads/ignite-950
Commit: 9de7d248d9ed720179887547772a899beea48488
Parents: 1c66078
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Wed Jun 24 16:26:07 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Wed Jun 24 16:26:07 2015 +0300

----------------------------------------------------------------------
 modules/docker/Dockerfile          | 38 +++++++++++++++++++++++++++++
 modules/docker/README.txt          | 11 +++++++++
 modules/docker/build_users_libs.sh | 23 ++++++++++++++++++
 modules/docker/download_ignite.sh  | 33 ++++++++++++++++++++++++++
 modules/docker/execute.sh          | 42 +++++++++++++++++++++++++++++++++
 modules/docker/run.sh              | 11 +++++++++
 6 files changed, 158 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9de7d248/modules/docker/Dockerfile
----------------------------------------------------------------------
diff --git a/modules/docker/Dockerfile b/modules/docker/Dockerfile
new file mode 100644
index 0000000..2723333
--- /dev/null
+++ b/modules/docker/Dockerfile
@@ -0,0 +1,38 @@
+# Start from a Debian image.
+FROM debian:8
+
+# Install tools.
+RUN apt-get update && apt-get install -y --fix-missing \
+  wget \
+  dstat \
+  maven \
+  git
+
+# Intasll Oracle JDK.
+RUN mkdir /opt/jdk
+
+RUN wget --header "Cookie: oraclelicense=accept-securebackup-cookie" \
+  http://download.oracle.com/otn-pub/java/jdk/7u76-b13/jdk-7u76-linux-x64.tar.gz
+
+RUN tar -zxf jdk-7u76-linux-x64.tar.gz -C /opt/jdk
+
+RUN rm jdk-7u76-linux-x64.tar.gz
+
+RUN update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.7.0_76/bin/java 100
+
+RUN update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.7.0_76/bin/javac 100
+
+# Sets java variables.
+ENV JAVA_HOME /opt/jdk/jdk1.7.0_76/
+
+# Create working directory
+RUN mkdir /home/ignite_home
+
+WORKDIR /home/ignite_home
+
+# Copy sh files and set permission
+ADD *.sh ./
+
+RUN chmod +x *.sh
+
+CMD ./run.sh
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9de7d248/modules/docker/README.txt
----------------------------------------------------------------------
diff --git a/modules/docker/README.txt b/modules/docker/README.txt
new file mode 100644
index 0000000..0299d4c
--- /dev/null
+++ b/modules/docker/README.txt
@@ -0,0 +1,11 @@
+Apache Ignite Docker module
+------------------------
+
+Apache Ignite Docker module provides Dockerfile and bash scripts for building docker image.
+
+Build image
+-------------------------------------
+
+cd to ./modules/docker
+
+sudo docker build .
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9de7d248/modules/docker/build_users_libs.sh
----------------------------------------------------------------------
diff --git a/modules/docker/build_users_libs.sh b/modules/docker/build_users_libs.sh
new file mode 100644
index 0000000..24f4420
--- /dev/null
+++ b/modules/docker/build_users_libs.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+if [ -z $GIT_REPO ]; then
+  echo Users git repo is not provided.
+
+  exit 0
+fi
+
+git clone $GIT_REPO user-repo
+
+cd user-repo
+
+if [ ! -z $GIT_BRANCH ]; then
+  git checkout $GIT_BRANCH
+fi
+
+if [ ! -z "$BUILD_CMD" ]; then
+  echo "Starting to execute build command: $BUILD_CMD"
+
+  eval "$BUILD_CMD"
+else
+  mvn clean package
+fi
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9de7d248/modules/docker/download_ignite.sh
----------------------------------------------------------------------
diff --git a/modules/docker/download_ignite.sh b/modules/docker/download_ignite.sh
new file mode 100644
index 0000000..6a8617f
--- /dev/null
+++ b/modules/docker/download_ignite.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+function download {
+  wget -O ignite.zip $1
+
+  unzip ignite.zip -d ignite
+
+  rm ignite.zip
+
+  exit 0
+}
+
+if [ ! -z $IGNITE_URL ]; then
+  download $IGNITE_URL
+fi
+
+if [ ! -z $IGNITE_VERSION ]; then
+  if [[ $IGNITE_VERSION  =~ [0-9]*\.[0-9]*\.0 ]]; then
+    download http://apache-mirror.rbc.ru/pub/apache/incubator/ignite/${IGNITE_VERSION}/apache-ignite-fabric-${IGNITE_VERSION}-incubating-bin.zip
+  else
+    download http://www.gridgain.com/media/gridgain-community-fabric-${IGNITE_VERSION}.zip
+  fi
+fi
+
+if [ -z $IGNITE_SOURCE ] || [ $IGNITE_SOURCE = "COMMUNITY" ]; then
+  download http://tiny.cc/updater/download_community.php
+fi
+
+if [ $IGNITE_SOURCE = "APACHE" ]; then
+  download http://tiny.cc/updater/download_ignite.php
+fi
+
+echo "Unsupported IGNITE_SOURCE type: ${IGNITE_SOURCE}"

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9de7d248/modules/docker/execute.sh
----------------------------------------------------------------------
diff --git a/modules/docker/execute.sh b/modules/docker/execute.sh
new file mode 100644
index 0000000..2aaaa2d
--- /dev/null
+++ b/modules/docker/execute.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+if [ ! -z "$GIT_REPO" ]; then
+  if [ -z "$LIB_PATTERN" ]; then
+    find user-repo/ -regextype posix-extended -regex "user-repo/target/.*(jar|zip)$" -exec cp {} ignite/*/libs \;
+  else
+    find user-repo/ -regextype posix-extended -regex "$LIB_PATTERN" -exec cp {} ignite/*/libs \;
+  fi
+fi
+
+if [ ! -z "$OPTION_LIBS" ]; then
+  IFS=, LIBS_LIST=("$OPTION_LIBS")
+
+  for lib in ${LIBS_LIST[@]}; do
+    cp -r ./ignite/*/libs/optional/"$lib"/* ./ignite/*/libs
+  done
+fi
+
+# Try to download
+if [ ! -z "$IGNITE_CONFIG" ]; then
+  wget -O ignite-config.xml "$IGNITE_CONFIG" 2>/dev/null
+
+  RETVAL=$?
+
+  [ $RETVAL -eq 0 ] && IGNITE_CONFIG=ignite-config.xml
+
+  [ $RETVAL -ne 0 ] && rm ignite-config.xml && echo "Failed download config: $IGNITE_CONFIG. Try to load config from classpath."
+fi
+
+if [ ! -z "$EXEC_CMD" ]; then
+  echo "Starting to execute command: $EXEC_CMD"
+
+  eval "$EXEC_CMD"
+
+  exit 0
+fi
+
+if [ -z "$IGNITE_CONFIG" ]; then
+  ignite/*/bin/ignite.sh
+else
+  ignite/*/bin/ignite.sh ignite-config.xml
+fi
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9de7d248/modules/docker/run.sh
----------------------------------------------------------------------
diff --git a/modules/docker/run.sh b/modules/docker/run.sh
new file mode 100644
index 0000000..42fb29d
--- /dev/null
+++ b/modules/docker/run.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+if [ -z $SKIP_DOWNLOAD ]; then
+  ./download_ignite.sh
+fi
+
+if [ -z $SKIP_BUILD_LIBS ]; then
+  ./build_users_libs.sh
+fi
+
+./execute.sh
\ No newline at end of file