You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by wi...@apache.org on 2015/11/12 18:28:03 UTC

[02/13] marmotta git commit: MARMOTTA-588: more work on a proper docker file

MARMOTTA-588: more work on a proper docker file


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/77a5d123
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/77a5d123
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/77a5d123

Branch: refs/heads/develop
Commit: 77a5d1232d3fb9525bd5fb78e00a2eda08100ec9
Parents: b18758d
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed Jul 1 12:27:07 2015 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed Jul 1 12:27:07 2015 +0200

----------------------------------------------------------------------
 launchers/marmotta-docker/Dockerfile | 74 ++++++++++++++++---------------
 launchers/marmotta-docker/README.md  |  9 +++-
 2 files changed, 45 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/77a5d123/launchers/marmotta-docker/Dockerfile
----------------------------------------------------------------------
diff --git a/launchers/marmotta-docker/Dockerfile b/launchers/marmotta-docker/Dockerfile
index 08f5d91..2eb235c 100644
--- a/launchers/marmotta-docker/Dockerfile
+++ b/launchers/marmotta-docker/Dockerfile
@@ -1,8 +1,10 @@
 # Dockerfile for Apache Marmotta
 
-FROM debian:jessie
-
+FROM debian:sid
 MAINTAINER Sergio Fernández <wi...@apache.org>
+WORKDIR /src
+EXPOSE 8080
+EXPOSE 5432
 
 # general configuration
 ENV DEBIAN_FRONTEND noninteractive
@@ -10,42 +12,42 @@ ENV baseurl http://localhost:8080/marmotta
 ENV dbname marmotta
 ENV dbuser marmotta
 ENV dbpass s3cr3t
-WORKDIR /code
+ENV conf /var/lib/marmotta/system-config.properties
 
-# make sure the package repository is up to date
+# install base system
+RUN sed -i.bak s/"exit 101"/"exit 0"/g /usr/sbin/policy-rc.d
 RUN apt-get update
-
-# install some required tools
-RUN apt-get install -y git maven openjdk-7-jdk postgresql curl gdebi
-RUN apt-get clean
-
-# get the source code
+RUN apt-get install -y apt-utils
+RUN apt-get upgrade -y
+RUN apt-get install -y sudo
+RUN apt-get install -y locales
+RUN locale-gen en_US.UTF-8 en_us && dpkg-reconfigure locales && dpkg-reconfigure locales && locale-gen C.UTF-8 && /usr/sbin/update-locale LANG=C.UTF-8
+RUN apt-get install -y git ssmtp
+RUN apt-get install -y openjdk-7-jre-headless openjdk-7-jdk maven
+RUN apt-get install -y tomcat7
+RUN apt-get install -y postgresql postgresql-common postgresql-contrib
+
+# pre-setup
+USER postgres
+RUN psql -c "CREATE USER $dbuser WITH PASSWORD '$dbpass'"
+RUN psql -c "CREATE DATABASE $dbname WITH OWNER $dbuser"
+USER root
+RUN mkdir -p "$(dirname $conf)"
+RUN echo "" > $conf
+RUN echo "security.enabled = false" >> $conf
+RUN echo "database.type = postgres" >> $conf
+RUN echo "database.url = jdbc:postgresql://localhost:5432/$dbname?prepareThreshold=3" >> $conf
+RUN echo "database.user = $dbuser" >> $conf
+RUN echo "database.password = $dbpas" >> $conf
+RUN chmod -R tomcat7:tomcat7 "$(dirname $conf)"
+
+# package from source code and install the webapp
 RUN git clone -b develop https://git-wip-us.apache.org/repos/asf/marmotta.git
-RUN cd marmotta && git pull
-
-# package from source code
-# RUN cd marmotta && mvn install -DskipTests -DskipITs -Djdeb.signing=false
-RUN cd marmotta/launchers/marmotta-webapp && mvn package -Djdeb.signing=false
-
-# install webapp
-RUN gdebi marmotta/launchers/marmotta-webapp/target/marmotta*.deb
+RUN cd marmotta/launchers/marmotta-webapp/ && mvn clean package -Djdeb.signing=false
+RUN dpkg -i marmotta/launchers/marmotta-webapp/target/marmotta*.deb
 
-# setup database
-RUN sudo -u postgres psql -c "CREATE USER $dbuser WITH PASSWORD '$dbpass'"
-RUN sudo -u postgres psql -c "CREATE DATABASE $dbname WITH OWNER $dbuser"
-
-# wait until it actually boots
-until [ "`curl --silent --show-error --connect-timeout 1 -I $baseurl/ | grep 'Coyote'`" != "" ]; do echo "marmotta not yet ready, sleeping for 10 seconds..." && sleep 10 done
-
-# for development purposes disable security
-RUN curl -X POST -H "Content-Type: application/json" -d '["false"]' $baseurl/config/data/security.enabled
-
-# configure postgres as database
-RUN curl -X POST -H "Content-Type: application/json" -d '["postgres"]' $baseurl/config/data/database.type
-RUN curl -X POST -H "Content-Type: application/json" -d '["jdbc:postgresql://localhost:5432/$dbname?prepareThreshold=3"]' $baseurl/config/data/database.url
-RUN curl -X POST -H "Content-Type: application/json" -d '["$dbuser"]' $baseurl/config/data/database.user
-RUN curl -X POST -H "Content-Type: application/json" -d '["$dbpass"]' $baseurl/config/data/database.password
-RUN curl -X POST $baseurl/system/database/reinit
-
-EXPOSE 8080
+# cleanup
+#RUN cd marmotta/ && mvn clean
+RUN apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y
+RUN mv /usr/sbin/policy-rc.d.bak /usr/sbin/policy-rc.d
 

http://git-wip-us.apache.org/repos/asf/marmotta/blob/77a5d123/launchers/marmotta-docker/README.md
----------------------------------------------------------------------
diff --git a/launchers/marmotta-docker/README.md b/launchers/marmotta-docker/README.md
index cc34468..9e45c2a 100644
--- a/launchers/marmotta-docker/README.md
+++ b/launchers/marmotta-docker/README.md
@@ -5,12 +5,17 @@ Apache Marmotta.
 
 ## Build image
 
-    sudo docker build .
+    sudo docker build -t marmotta .
 
 ## Get image
 
 @@TODO@@: push it to asf or docker hub
 
-## Run it
+## Run
 
     docker run -p 8080:8080
+
+## Accesss
+
+Access Marmotta runing inside the container, at [172.17.42.1:8080/marmotta](http://172.17.42.1:8080/marmotta) 
+(IP address may be different, use `docker inspect CONTAINER_ID` for details).