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 2016/05/02 11:50:22 UTC

[45/50] [abbrv] marmotta git commit: MARMOTTA-636: fixed Dockerfile

MARMOTTA-636: fixed Dockerfile


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

Branch: refs/heads/MARMOTTA-584
Commit: 1eb1bceb387af2c8ad0049979f217666a3600c95
Parents: bfe5847
Author: Sergio Fern�ndez <wi...@apache.org>
Authored: Fri Apr 29 15:51:21 2016 +0200
Committer: Sergio Fern�ndez <wi...@apache.org>
Committed: Fri Apr 29 15:51:21 2016 +0200

----------------------------------------------------------------------
 .dockerignore                        |  2 +
 Dockerfile                           | 81 +++++++++++++++++++++++++++++++
 launchers/marmotta-webapp/Dockerfile | 72 ---------------------------
 3 files changed, 83 insertions(+), 72 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/1eb1bceb/.dockerignore
----------------------------------------------------------------------
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..f649579
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,2 @@
+**/target
+*~

http://git-wip-us.apache.org/repos/asf/marmotta/blob/1eb1bceb/Dockerfile
----------------------------------------------------------------------
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..33f8d60
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,81 @@
+# Dockerfile for Apache Marmotta
+
+FROM debian:jessie-backports
+MAINTAINER Sergio Fern�ndez <wi...@apache.org>
+
+EXPOSE 8080
+
+WORKDIR /src
+ADD . /src
+
+# configuration
+ENV DEBIAN_FRONTEND noninteractive
+ENV DB_NAME marmotta
+ENV DB_USER marmotta
+ENV DB_PASS s3cr3t
+ENV PG_VERSION 9.4
+ENV WAR_PATH /src/launchers/marmotta-webapp/target/marmotta.war
+ENV CONF_PATH /var/lib/marmotta/system-config.properties
+
+# prepare the environment
+RUN apt-get update \
+    && apt-get upgrade -y \
+    && apt-get install -y \
+		openjdk-8-jdk \
+		maven \
+        tomcat7 \
+    || apt-get install -y -f
+
+# build
+RUN mvn clean install -DskipTests -DskipITs
+RUN test -e $WAR_PATH || exit
+
+# install and configure postgres from the PGDG repo
+RUN apt-get update && apt-get install -y locales apt-utils \
+	&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
+ENV LANG en_US.utf8
+RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
+RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main' > /etc/apt/sources.list.d/pgdg.list
+RUN apt-get update \
+	&& apt-get install -y postgresql-common \
+	&& sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
+	&& apt-get install -y \
+		postgresql-$PG_VERSION \
+		postgresql-contrib-$PG_VERSION
+RUN pg_createcluster $PG_VERSION main --start
+USER postgres
+RUN service postgresql start \
+    && psql --command "CREATE USER $DB_USER WITH PASSWORD '$DB_PASS';" \
+    && psql --command "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER;"
+USER root
+RUN service postgresql stop
+RUN echo "host all  all    127.0.0.1/32  md5" >> /etc/postgresql/$PG_VERSION/main/pg_hba.conf
+RUN echo "listen_addresses='*'" >> /etc/postgresql/$PG_VERSION/main/postgresql.conf
+
+# install the webapp
+#RUN dpkg --debug=2000 --install target/marmotta_*_all.deb <-- we'd need to fix the postinst
+RUN mkdir -p /usr/share/marmotta
+RUN cp $WAR_PATH /usr/share/marmotta/
+RUN chown tomcat7:tomcat7 /usr/share/marmotta/marmotta.war
+RUN cp /src/launchers/marmotta-webapp/src/deb/tomcat/marmotta.xml /var/lib/tomcat7/conf/Catalina/localhost/
+RUN chown tomcat7:tomcat7 /var/lib/tomcat7/conf/Catalina/localhost/marmotta.xml
+RUN mkdir -p "$(dirname $CONF_PATH)"
+RUN echo "security.enabled = false" > $CONF_PATH
+RUN echo "database.type = postgres" >> $CONF_PATH
+RUN echo "database.url = jdbc:postgresql://localhost:5432/$DB_NAME?prepareThreshold=3" >> $CONF_PATH
+RUN echo "database.user = $DB_USER" >> $CONF_PATH
+RUN echo "database.password = $DB_PASS" >> $CONF_PATH
+RUN chown -R tomcat7:tomcat7 "$(dirname $CONF_PATH)"
+
+# cleanup
+RUN mvn clean \
+    && rm -rf ~/.m2 \
+    && apt-get remove maven --purge \
+    && apt-get autoremove \
+    && apt-get clean -y \
+    && apt-get autoclean -y \
+    && apt-get autoremove -y \
+    && rm -rf /var/lib/apt/lists/*
+
+ENTRYPOINT ["/marmotta-webapp/src/docker/entrypoint.sh"]
+

http://git-wip-us.apache.org/repos/asf/marmotta/blob/1eb1bceb/launchers/marmotta-webapp/Dockerfile
----------------------------------------------------------------------
diff --git a/launchers/marmotta-webapp/Dockerfile b/launchers/marmotta-webapp/Dockerfile
deleted file mode 100644
index f89585c..0000000
--- a/launchers/marmotta-webapp/Dockerfile
+++ /dev/null
@@ -1,72 +0,0 @@
-# Dockerfile for Apache Marmotta
-
-FROM debian:jessie
-MAINTAINER Sergio Fern�ndez <wi...@apache.org>
-
-EXPOSE 8080
-
-WORKDIR /marmotta-webapp
-ADD . /marmotta-webapp
-
-# configuration
-ENV DEBIAN_FRONTEND noninteractive
-ENV DB_NAME marmotta
-ENV DB_USER marmotta
-ENV DB_PASS s3cr3t
-ENV PG_VERSION 9.4
-ENV WAR_PATH target/marmotta.war
-ENV CONF_PATH /var/lib/marmotta/system-config.properties
-
-# test build
-RUN test -e $WAR_PATH || exit
-
-# install and configure postgres from the PGDG repo
-RUN apt-get update && apt-get install -y locales apt-utils \
-	&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
-ENV LANG en_US.utf8
-RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
-RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main' > /etc/apt/sources.list.d/pgdg.list
-RUN apt-get update \
-	&& apt-get install -y postgresql-common \
-	&& sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
-	&& apt-get install -y \
-		postgresql-$PG_VERSION \
-		postgresql-contrib-$PG_VERSION
-RUN pg_createcluster $PG_VERSION main --start
-USER postgres
-RUN service postgresql start \
-    && psql --command "CREATE USER $DB_USER WITH PASSWORD '$DB_PASS';" \
-    && psql --command "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER;"
-USER root
-RUN service postgresql stop
-RUN echo "host all  all    127.0.0.1/32  md5" >> /etc/postgresql/$PG_VERSION/main/pg_hba.conf
-RUN echo "listen_addresses='*'" >> /etc/postgresql/$PG_VERSION/main/postgresql.conf
-
-# base requirements
-RUN apt-get update \
-	&& apt-get install -y \
-		openjdk-7-jre-headless \
-		tomcat7
-RUN service tomcat7 stop
-
-# package from source code and install the webapp
-#RUN dpkg --debug=2000 --install target/marmotta_*_all.deb <-- we'd need to fix the postinst
-RUN mkdir -p /usr/share/marmotta
-RUN cp $WAR_PATH /usr/share/marmotta/
-RUN chown tomcat7:tomcat7 /usr/share/marmotta/marmotta.war
-RUN cp src/deb/tomcat/marmotta.xml /var/lib/tomcat7/conf/Catalina/localhost/
-RUN chown tomcat7:tomcat7 /var/lib/tomcat7/conf/Catalina/localhost/marmotta.xml
-RUN mkdir -p "$(dirname $CONF_PATH)"
-RUN echo "security.enabled = false" > $CONF_PATH
-RUN echo "database.type = postgres" >> $CONF_PATH
-RUN echo "database.url = jdbc:postgresql://localhost:5432/$DB_NAME?prepareThreshold=3" >> $CONF_PATH
-RUN echo "database.user = $DB_USER" >> $CONF_PATH
-RUN echo "database.password = $DB_PASS" >> $CONF_PATH
-RUN chown -R tomcat7:tomcat7 "$(dirname $CONF_PATH)"
-
-# cleanup
-#RUN mvn clean
-RUN apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
-
-ENTRYPOINT ["/marmotta-webapp/src/docker/entrypoint.sh"]
-