Public Repository

Last pushed: a year ago
Short Description
Sample java application running on tomcat server.
Full Description

This image contains JDK, Tomcat and MySql server, and an application deployed on tomcat.

Dockerfile:

FROM sumitsaiwal/mysql:v1

MAINTAINER sumitsaiwal@gmail.com

ENV JAVA_HOME /usr/lib/jvm/default-java
ENV CATALINA_HOME /opt/apache-tomcat-7.0.69
ENV PATH $CATALINA_HOME/bin:$PATH

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y default-jdk && rm -rf /var/lib/apt/lists/*

COPY leavedb.sql mysqldb_conf.sh easyleave.war ./

ADD http://repo2.maven.org/maven2/org/apache/tomcat/tomcat/7.0.69/tomcat-7.0.69.tar.gz ./
RUN tar xvzf tomcat-7.0.69.tar.gz
RUN mv apache-tomcat-7.0.69 /opt/

RUN sh mysqldb_conf.sh
RUN mv easyleave.war $CATALINA_HOME/webapps

RUN rm -rf tomcat-7.0.69.tar.gz
RUN rm -rf leavedb.sql
RUN rm -rf mysqldb_conf.sh

ADD entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

#EXPOSE 3306
EXPOSE 8080

#CMD ["mysqld_safe"]

ENTRYPOINT /entrypoint.sh


entrypoint.sh:

/etc/init.d/mysql start
catalina.sh run

#mysqld


mysqldb_conf.sh:

#!/bin/sh

MyUSER="root"

#$1=dbUsername
MyPASS="admin@123"

#$2=MySQLpassword;dbPassword
/etc/init.d/mysql restart
mysqladmin -u root password $MyPASS

#assigning password to root user

C1="CREATE DATABASE IF NOT EXISTS leavedb;"
C2="USE leavedb;"
C3="GRANT ALL PRIVILEGES ON . TO '$MyUSER'@'%' IDENTIFIED BY '$MyPASS' WITH GRANT OPTION;"
C4="FLUSH PRIVILEGES;"
SQL="${C1}${C2}${C3}${C4}"

mysql -h localhost "--user=$MyUSER" "--password=$MyPASS" -Bse "$SQL"

#creates a database and grants all the privilegs to dbUser
mysql -u $MyUSER -p$MyPASS leavedb < leavedb.sql

exit 0

Docker Pull Command
Owner
sumitsaiwal

Comments (0)