diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..32c0b4b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +FROM ubuntu +RUN echo "Run One Updated" +RUN echo "RUN TWO" +RUN echo "RUN Three" +CMD date +ENTRYPOINT [ "echo", "hello" ] + + +#git +FROM alpine/git as repo + +MAINTAINER name mylandmarktech@gmail.com + +WORKDIR /app +RUN git clone https://github.com/LandmakTechnology/maven-web-app.git + +#Maven +FROM maven:3.5-jdk-8-alpine as build +WORKDIR /app +COPY --from=repo /app/maven-web-app /app +RUN mvn install + +#Tomcat +FROM tomcat:8.0.20-jre8 +COPY --from=build /app/target/maven-web-app*.war /usr/local/tomcat/webapps/maven-web-app.war + + diff --git a/Dockerfile_CMD b/Dockerfile_CMD new file mode 100644 index 0000000..24cd70c --- /dev/null +++ b/Dockerfile_CMD @@ -0,0 +1,2 @@ +FROM ubuntu +CMD ["echo" ,"FROM DockerFile"] diff --git a/Dockerfile_CMDENT b/Dockerfile_CMDENT new file mode 100644 index 0000000..dc6bd58 --- /dev/null +++ b/Dockerfile_CMDENT @@ -0,0 +1,3 @@ +FROM ubuntu +CMD ["echo" ,"FROM DockerFile"] +ENTRYPOINT ["ls", "/"] diff --git a/Dockerfile_ENTRYPOINT b/Dockerfile_ENTRYPOINT new file mode 100644 index 0000000..34fee6b --- /dev/null +++ b/Dockerfile_ENTRYPOINT @@ -0,0 +1,2 @@ +FROM ubuntu +ENTRYPOINT ["echo" ,"FROM DockerFile"] diff --git a/Dockerfile_Tomcat b/Dockerfile_Tomcat new file mode 100644 index 0000000..9637a3c --- /dev/null +++ b/Dockerfile_Tomcat @@ -0,0 +1,4 @@ +FROM tomcat:8.0.20-jre8 +RUN sed -i '/<\/tomcat-users>/ i\' /usr/local/tomcat/conf/tomcat-users.xml +#COPY tomcat-users.xml /usr/local/tomcat/conf/tomcat-users.xml +COPY java-web-app.war /usr/local/tomcat/webapps/gradle-web-app.war diff --git a/Dockerfile_Tomcat_CentOs b/Dockerfile_Tomcat_CentOs new file mode 100644 index 0000000..27152d2 --- /dev/null +++ b/Dockerfile_Tomcat_CentOs @@ -0,0 +1,19 @@ +FROM centos + +MAINTAINER mylandmarktech@gmail.com + +RUN mkdir /opt/tomcat/ + +WORKDIR /opt/tomcat +#RUN curl -O https://downloads.apache.org/tomcat/tomcat-9/v9.0.38/bin/apache-tomcat-9.0.38.tar.gz +ADD https://downloads.apache.org/tomcat/tomcat-9/v9.0.38/bin/apache-tomcat-9.0.38.tar.gz . +RUN tar xvfz apache*.tar.gz +RUN mv apache-tomcat-9.0.37/* /opt/tomcat/. +RUN yum -y install java +RUN java -version + +WORKDIR /opt/tomcat/webapps + +EXPOSE 8080 + +CMD ["/opt/tomcat/bin/catalina.sh", "run"] diff --git a/Dockerfile_Tomcat_Ubuntu b/Dockerfile_Tomcat_Ubuntu new file mode 100644 index 0000000..4124007 --- /dev/null +++ b/Dockerfile_Tomcat_Ubuntu @@ -0,0 +1,9 @@ +FROM ubuntu:latest +RUN apt-get -y update && apt-get -y upgrade \ + && apt-get -y install openjdk-8-jdk wget +RUN mkdir /usr/local/tomcat +RUN wget http://apachemirror.wuchna.com/tomcat/tomcat-8/v8.5.46/bin/apache-tomcat-8.5.46.tar.gz -O /tmp/tomcat.tar.gz +RUN cd /tmp && tar xvfz tomcat.tar.gz \ + && cp -Rv /tmp/apache-tomcat-8.5.46/* /usr/local/tomcat/ +EXPOSE 8080 +CMD /usr/local/tomcat/bin/catalina.sh run diff --git a/Dockerfile_Wildfly b/Dockerfile_Wildfly new file mode 100644 index 0000000..59f9c9d --- /dev/null +++ b/Dockerfile_Wildfly @@ -0,0 +1,3 @@ +FROM jboss/wildfly + +ADD target/maven-web-app.war /opt/jboss/wildfly/standalone/deployments/ \ No newline at end of file diff --git a/Dockerfile_Wildfly_Admin b/Dockerfile_Wildfly_Admin new file mode 100644 index 0000000..8c4edb2 --- /dev/null +++ b/Dockerfile_Wildfly_Admin @@ -0,0 +1,5 @@ +FROM jboss/wildfly + +RUN /opt/jboss/wildfly/bin/add-user.sh admin password --silent + +CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-b", "0.0.0.0", "-bmanagement", "0.0.0.0"] diff --git a/Dockerfile_nginx b/Dockerfile_nginx new file mode 100644 index 0000000..ac9f51b --- /dev/null +++ b/Dockerfile_nginx @@ -0,0 +1,2 @@ +FROM nginx:alpine +COPY index.html /usr/share/nginx/html \ No newline at end of file diff --git a/MultiStageDockerfile b/MultiStageDockerfile new file mode 100644 index 0000000..c65d029 --- /dev/null +++ b/MultiStageDockerfile @@ -0,0 +1,17 @@ +#git +FROM alpine/git as repo + +MAINTAINER mylandmarktech@gmail.com + +WORKDIR /app +RUN git clone https://github.com/LandmakTechnology/maven-web-app.git + +#Maven +FROM maven:3.5-jdk-8-alpine as build +WORKDIR /app +COPY --from=repo /app/maven-web-app /app +RUN mvn install + +#Tomcat +FROM tomcat:8.0.20-jre8 +COPY --from=build /app/target/maven-web-app*.war /usr/local/tomcat/webapps/maven-web-app.war diff --git a/index.html b/index.html new file mode 100644 index 0000000..c1d4793 --- /dev/null +++ b/index.html @@ -0,0 +1 @@ +

Hello World

diff --git a/java-web-app.war b/java-web-app.war new file mode 100644 index 0000000..5fe05c4 Binary files /dev/null and b/java-web-app.war differ diff --git a/node.txt b/node.txt new file mode 100644 index 0000000..a75fd10 --- /dev/null +++ b/node.txt @@ -0,0 +1,52 @@ +node +{ +def mavenHome = tool name: "maven3.6.3" + + stage("CodeClone") + { + git credentialsId: 'gitCredentials', url: 'https://github.com/LandmakTechnology/maven-web-app.git' + } + stage("CreatePackage") + { + sh "${mavenHome}/bin/mvn clean package" + } + + stage('CodeQualityReports') + { + //sh "${mavenHome}/bin/mvn sonar:sonar" + } + stage('UploadBuildArtifacts') + { + sh "${mavenHome}/bin/mvn deploy" + } + stage('Deploy2Tomcat') + { + deploy adapters: [tomcat9(credentialsId: 'TomcatCredentials', path: '', url: 'http://34.239.176.96:8080/')], contextPath: null, war: '**/maven-web-app.war' + } + stage('BuildDockerImage') + { + //sh "docker stop myapp" + //sh "docker rm -f myapp" + sh "docker rmi -f mylandmarktech/maven-web-app" + sh "docker build -t mylandmarktech/maven-web-app ." + } + stage('Push2DockerHub') + { + withCredentials([string(credentialsId: 'DockerHubPwd', variable: 'DockerHubPwd')]) { + sh "docker login -u mylandmarktech -p $DockerHubPwd" +} + } + sh "docker push mylandmarktech/maven-web-app" + } + stage('DeployAppInDockerContainer') + { + sh "docker run -d -p 8888:8080 --name myapp mylandmarktech/maven-web-app" + } + stage('Email notification') + { +emailext body: ''' +Build Status +Landmark Technology ++ 1 437 215 2483\'\'\', recipientProviders: [developers()], subject: \'Build status\', to: \'legah2000@gmail.com\'''', recipientProviders: [developers()], subject: 'Build', to: 'legah2002@gmail.com' + } +} \ No newline at end of file diff --git a/tomcat-users.xml b/tomcat-users.xml new file mode 100644 index 0000000..960cf93 --- /dev/null +++ b/tomcat-users.xml @@ -0,0 +1,46 @@ + + + + + + + + +