Created
August 31, 2017 07:25
-
-
Save j-mprabhakaran/358118d3ff080c20ad0399e6d98ffda2 to your computer and use it in GitHub Desktop.
Dockerize Java Application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM centos:7 | |
| MAINTAINER AuthorName <[email protected]> | |
| ENV JAVA_HOME /opt/jdk1.8.0_144 | |
| ENV M2_HOME /opt/apache-maven-3.3.9 | |
| ENV CATALINA_HOME /opt/tomcat | |
| ENV PATH $CATALINA_HOME/bin:$PATH | |
| RUN yum install -y wget && \ | |
| wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz" && \ | |
| tar xzf jdk-8u144-linux-x64.tar.gz -C /opt/ && \ | |
| alternatives --install /usr/bin/java java /opt/jdk1.8.0_144/bin/java 2 && \ | |
| alternatives --install /usr/bin/jar jar /opt/jdk1.8.0_144/bin/jar 2 && \ | |
| alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_144/bin/javac 2 && \ | |
| alternatives --set jar /opt/jdk1.8.0_144/bin/jar && \ | |
| alternatives --set javac /opt/jdk1.8.0_144/bin/javac && \ | |
| wget --no-check-certificate -c http://apache-mirror.rbc.ru/pub/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz && \ | |
| tar xzf apache-maven-3.3.9-bin.tar.gz -C /opt/ && \ | |
| alternatives --install /usr/bin/mvn mvn /opt/apache-maven-3.3.9/bin/mvn 2 && \ | |
| wget --no-check-certificate -c http://apache-mirror.rbc.ru/pub/apache/tomcat/tomcat-9/v9.0.0.M26/bin/apache-tomcat-9.0.0.M26.tar.gz && \ | |
| mkdir /opt/tomcat && \ | |
| tar -xzf apache-tomcat-9.0.0.M26.tar.gz -C /opt/tomcat --strip-components=1 && \ | |
| yum install -y git zip unzip net-tools nano && \ | |
| rm -f jdk-8u144-linux-x64.tar.gz apache-maven-3.3.9-bin.tar.gz apache-tomcat-9.0.0.M26.tar.gz | |
| COPY /home/user/Builds/your-java-app.zip /opt/tomcat | |
| RUN cd /opt/tomcat && \ | |
| unzip your-java-app.zip -d /opt/tomcat/webapps/ | |
| EXPOSE 8080 | |
| CMD ["catalina.sh", "run"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment