diff options
Diffstat (limited to 'devgerrit/Dockerfile')
-rwxr-xr-x | devgerrit/Dockerfile | 163 |
1 files changed, 163 insertions, 0 deletions
diff --git a/devgerrit/Dockerfile b/devgerrit/Dockerfile new file mode 100755 index 0000000..5fca45a --- /dev/null +++ b/devgerrit/Dockerfile @@ -0,0 +1,163 @@ +#=============================================================================== +# This file is designed for Tizen infrastructure. +# Author onstudy@samsung.com +#=============================================================================== +FROM ubuntu:14.04 +MAINTAINER onstudy@samsung.com + +RUN echo "deb http://archive.ubuntu.com/ubuntu trusty main universe" >> /etc/apt/sources.list + +#### If you are use the proxy in your enviroment, add below line on building.#### +#ENV ftp_proxy ftp://<ip> +#ENV http_proxy http://<ip> +#ENV https_proxy https://<ip> +#ENV socks_proxy socks://<ip> + + +#### UPDATE #### +RUN apt-get -y update +RUN apt-get install -y vim tar wget telnet supervisor sudo + +#### INSTALL SLAPD #### +RUN apt-get install -y slapd ldap-utils phpldapadmin + +#### INSTALL APACHE2 #### +RUN apt-get install -y php5-mysql php5-gd libapache2-mod-php5 mysql-server +RUN apt-get install -y apache2 apache2-utils php5 php5-ldap phpldapadmin php5-mcrypt libapache2-mod-proxy-html +RUN sed -i 's/variables_order = "GPCS"/variables_order = "EGPCS"/g' /etc/php5/apache2/php.ini +ENV APACHE_RUN_USER www-data +ENV APACHE_RUN_GROUP www-data +ENV APACHE_LOG_DIR /var/log/apache2 +ENV APACHE_PID_FILE /var/run/apache2.pid +ENV APACHE_RUN_DIR /var/run/apache2 +ENV APACHE_LOCK_DIR /var/lock/apache2 + +RUN a2enmod rewrite \ + && a2enmod proxy \ + && a2enmod proxy_connect \ + && a2enmod proxy_ftp \ + && a2enmod proxy_http + +#### INSTALL GIT #### +RUN apt-get install -y git-core git-review openssh-server + +#### DOWNLOAD DRUPAL #### +# Create needed directories +ENV HTDOCS_DIR /var/www/html + +RUN wget http://ftp.drupal.org/files/projects/drupal-7.28.tar.gz \ + && tar -xzf drupal-7.28.tar.gz \ + && rm drupal-7.28.tar.gz \ + && mv drupal-7.28 ${HTDOCS_DIR}/drupal \ + && mkdir -p ${HTDOCS_DIR}/drupal/sites/default/files/ \ + && chmod o+w ${HTDOCS_DIR}/drupal/sites/default/files/ \ + && chown -R ${APACHE_RUN_USER}:${APACHE_RUN_USER} ${HTDOCS_DIR}/drupal/sites/default/files/ + +#### LDAP MODULES #### +ENV MODULES_DIR ${HTDOCS_DIR}/drupal/sites/all/modules + +#### DOWNLOAD SIMPLE LDAP MODULES #### +RUN wget http://ftp.drupal.org/files/projects/simple_ldap-7.x-1.4.tar.gz \ + && tar -xzf simple_ldap-7.x-1.4.tar.gz \ + && rm simple_ldap-7.x-1.4.tar.gz \ + && mv simple_ldap ${MODULES_DIR}/simple_ldap \ + && chown -R ${APACHE_RUN_USER}:${APACHE_RUN_USER} ${MODULES_DIR}/simple_ldap/ + +#### DOWNLOAD CTOOLS MODULES #### +RUN wget http://ftp.drupal.org/files/projects/ctools-7.x-1.5.tar.gz \ + && tar -xzf ctools-7.x-1.5.tar.gz \ + && rm ctools-7.x-1.5.tar.gz \ + && mv ctools ${MODULES_DIR}/ctools \ + && chown -R ${APACHE_RUN_USER}:${APACHE_RUN_USER} ${MODULES_DIR}/ctools/ + +#### DOWNLOAD VIEWS MODULES #### +RUN wget http://ftp.drupal.org/files/projects/views-7.x-3.8.tar.gz \ + && tar -xzf views-7.x-3.8.tar.gz \ + && rm views-7.x-3.8.tar.gz \ + && mv views ${MODULES_DIR}/views \ + && chown -R ${APACHE_RUN_USER}:${APACHE_RUN_USER} ${MODULES_DIR}/views/ + +#### FIX DRUPAL ERROR #### +ADD drupal/${HTDOCS_DIR}/drupal/sites/all/modules/simple_ldap/simple_ldap_user/simple_ldap_user.api.php ${HTDOCS_DIR}/drupal/sites/all/modules/simple_ldap/simple_ldap_user/simple_ldap_user.api.php +ADD drupal/${HTDOCS_DIR}/drupal/sites/all/modules/simple_ldap/simple_ldap_user/simple_ldap_user.module ${HTDOCS_DIR}/drupal/sites/all/modules/simple_ldap/simple_ldap_user/simple_ldap_user.module + + +#### INSTALL ORACLE JAVA 7 SDK #### +ENV JVM_DIR /usr/lib/jvm +RUN mkdir -p "${JVM_DIR}" + +ENV DOWNLOAD_DIR /tmp/downloads +RUN mkdir -p "${DOWNLOAD_DIR}" + +RUN wget -q --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" -O "${DOWNLOAD_DIR}/jdk-7u60-linux-x64.tar.gz" "http://download.oracle.com/otn-pub/java/jdk/7u60-b19/jdk-7u60-linux-x64.tar.gz" + +RUN tar -xzf "${DOWNLOAD_DIR}/jdk-7u60-linux-x64.tar.gz" +RUN rm -f "${DOWNLOAD_DIR}/jdk-7u60-linux-x64.tar.gz" +RUN mv "jdk1.7.0_60" "${JVM_DIR}/java-1.7.0_60-oracle-x64" +RUN ln -s "${JVM_DIR}/java-1.7.0_60-oracle-x64" "${JVM_DIR}/java-1.7.0-oracle-x64" + +ADD ./jdk/java-1.7.0-oracle-x64.jinfo ${JVM_DIR}/.java-1.7.0-oracle-x64.jinfo +RUN cat "${JVM_DIR}/.java-1.7.0-oracle-x64.jinfo" | grep -E '^(jre|jdk|hl)' | awk '{print "/usr/bin/" $2 " " $2 " " $3 " 30 \n"}' | xargs -t -n4 update-alternatives --install +ENV JAVA_HOME ${JVM_DIR}/java-1.7.0-oracle-x64 + +#### DOWNLOAD GERRIT #### +ENV GERRIT_HOME /home/gerrit +ENV GERRIT_CONFIG_PATH /home/gerrit/gerrit/etc/gerrit.config +ENV GERRIT_USER gerrit +ENV GERRIT_WAR /home/gerrit/gerrit.war + +RUN useradd -ms /bin/bash ${GERRIT_USER} \ + && usermod -aG root ${GERRIT_USER} \ + && wget http://gerrit-releases.storage.googleapis.com/gerrit-2.9.4.war -O /tmp/gerrit.war \ + && mkdir -p $GERRIT_HOME/gerrit \ + && mv /tmp/gerrit.war $GERRIT_WAR \ + && chmod 755 $GERRIT_WAR \ + && chown -R ${GERRIT_USER}:${GERRIT_USER} $GERRIT_HOME + +USER gerrit +RUN java -jar $GERRIT_WAR init --batch -d $GERRIT_HOME/gerrit +USER root + +RUN wget http://repo2.maven.org/maven2/mysql/mysql-connector-java/5.1.21/mysql-connector-java-5.1.21.jar -O $GERRIT_HOME/gerrit/lib/mysql-connector-java-5.1.21.jar \ + && wget http://www.bouncycastle.org/download/bcpkix-jdk15on-149.jar -O $GERRIT_HOME/gerrit/lib/bcpkix-jdk15on-149.jar \ + && wget http://www.bouncycastle.org/download/bcprov-jdk15on-149.jar -O $GERRIT_HOME/gerrit/lib/bcprov-jdk15on-149.jar + +ADD ./gerrit/plugins/ $GERRIT_HOME/gerrit/plugins/ + +#### FIX APACHE2 #### +#gerrit virtualhost 80 port +RUN rm /etc/apache2/sites-enabled/000-default.conf + +#### FIX PHPLDAPADMIN #### +#PhpLdapAdmin password error with PHP 5 +ADD ./phpldapadmin/usr/share/phpldapadmin/lib/TemplateRender.php /usr/share/phpldapadmin/lib/TemplateRender.php + +#### BACKUP GERRIT #### +RUN mv /home/gerrit/gerrit /home/gerrit/backup \ + && rm -rf /home/gerrit/gerrit + +#### BACKUP PHPLDAPADMIN #### +RUN cp -rf /etc/phpldapadmin /etc/phpldapadmin_backup + +#### BACKUP DRUPAL SETTING #### +RUN cp -rf ${HTDOCS_DIR}/drupal/sites/default ${HTDOCS_DIR}/drupal/sites/default_backup + +#### START SCRIPT #### +ADD ./script/phpldapadmin.sh /srv/script/phpldapadmin.sh +ADD ./script/gerrit.sh /srv/script/gerrit.sh +ADD ./script/drupal.sh /srv/script/drupal.sh +ADD ./script/initdb.sh /srv/script/initdb.sh +ADD ./script/slapd.sh /srv/script/slapd.sh +ADD ./script/startup.sh /srv/script/startup.sh +RUN chmod +x /srv/script/* + +ADD ./supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf + +# Set environment variables. +ENV HOME /root +ENV TERM xterm + +WORKDIR /srv/script +EXPOSE 80 389 29418 +VOLUME ["/etc/ldap", "/var/lib/ldap", "/run/slapd"] +CMD ["/bin/bash","/srv/script/startup.sh"] |