-
Notifications
You must be signed in to change notification settings - Fork 24
/
Dockerfile
66 lines (54 loc) · 2.41 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
FROM centos:centos6
MAINTAINER [email protected]
# Install Oracle Java JDK8
ENV JDK8_VERSION 92
#RUN yum install -y wget
#ENV JDK_DOWNLOAD_PATH 8u${JDK8_VERSION}-b14/jdk-8u${JDK8_VERSION}-linux-x64.rpm
#RUN wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/${JDK_DOWNLOAD_PATH} -O jdk-linux-x64.rpm
ADD jdk-8u${JDK8_VERSION}-linux-x64.rpm /jdk-linux-x64.rpm
RUN yum install -y jdk-linux-x64.rpm
RUN rm jdk-linux-x64.rpm
ENV JAVA_HOME /usr/java/jdk1.8.0_${JDK8_VERSION}
ENV PATH $JAVA_HOME/bin:$PATH
# set timezone to UTC
RUN mv /etc/localtime /etc/localtime.bak
RUN ln -s /usr/share/zoneinfo/Etc/UTC /etc/localtime
# Environment vars: Tomcat
ENV TOMCAT_MAJOR_VERSION 8
ENV TOMCAT_MINOR_VERSION 8.0.14
ENV CATALINA_HOME /tomcat
# Install Tomcat
RUN curl -O -k https://archive.apache.org/dist/tomcat/tomcat-${TOMCAT_MAJOR_VERSION}/v${TOMCAT_MINOR_VERSION}/bin/apache-tomcat-${TOMCAT_MINOR_VERSION}.tar.gz \
&& curl -O -k https://archive.apache.org/dist/tomcat/tomcat-${TOMCAT_MAJOR_VERSION}/v${TOMCAT_MINOR_VERSION}/bin/apache-tomcat-${TOMCAT_MINOR_VERSION}.tar.gz.md5 \
&& md5sum apache-tomcat-${TOMCAT_MINOR_VERSION}.tar.gz.md5 \
&& tar zxf apache-tomcat-*.tar.gz \
&& rm apache-tomcat-*.tar.gz* \
&& mv apache-tomcat-${TOMCAT_MINOR_VERSION} tomcat
RUN cd ${CATALINA_HOME}/bin;chmod +x *.sh
# Install Maven
RUN yum -y install wget
RUN wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
RUN sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
RUN yum install -y apache-maven
RUN mvn --version
# Build sample project
ENV PROJECT_NAME SampleApp
ENV PROJECT_HOME https://github.com/appdynamics
ENV APP_NAME SampleApp
#RUN yum install -y git
#RUN git clone ${PROJECT_HOME}/${PROJECT_NAME}.git
#RUN cd ${PROJECT_NAME}; mvn clean install
#ADD SampleApp.zip /
#RUN yum install -y unzip
#RUN unzip -q /SampleApp.zip
RUN mkdir ${APP_NAME}
ADD pom.xml /${APP_NAME}/
ADD src /${APP_NAME}/src/
RUN cd /${APP_NAME}; mvn clean install
# Copy war file to Tomcat
RUN cp ${PROJECT_NAME}/target/${APP_NAME}.war ${CATALINA_HOME}/webapps/
#ADD startup.sh /
#RUN chmod +x /startup.sh
#CMD /startup.sh
CMD cd ${CATALINA_HOME}/bin; java -cp ${CATALINA_HOME}/bin/bootstrap.jar:${CATALINA_HOME}/bin/tomcat-juli.jar org.apache.catalina.startup.Bootstrap
EXPOSE 8080