-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
68 lines (52 loc) · 2.42 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
#Sample Dockerfile for a Java webapp running on Tomcat + Apache
FROM centos:centos7
#MAINTAINER Chris Birchall ([email protected])
# Java installation.
#
# You have to either start with an image that has Java 7 pre-installed,
# or manually download Java once, host it somewhere, and wget it.
# RUN wget -O /tmp/jdk-8u20-linux-x64.rpm http://foo/jdk-8u20-linux-x64.rpm
ADD ./jdk /tmp
RUN rpm -i /tmp/jdk-8u40-linux-x64.rpm
RUN rm /tmp/jdk-8u40-linux-x64.rpm
# Other stuff can be installed with yum
# (Note that git is quite old. If you want 1.8.x, install from source.)
ADD ./etc/nginx.repo /etc/yum/repos.d/nginx.repo
RUN yum -y --noplugins --verbose update
RUN yum -y --noplugins --verbose install nginx git wget tar
# Tomcat 7
#
# Not available on yum, so install manually
RUN wget -O /tmp/apache-tomcat-7.0.61.tar.gz http://ftp.meisei-u.ac.jp/mirror/apache/dist/tomcat/tomcat-7/v7.0.61/bin/apache-tomcat-7.0.61.tar.gz
RUN cd /usr/local && tar xzf /tmp/apache-tomcat-7.0.61.tar.gz
RUN ln -s /usr/local/apache-tomcat-7.0.61 /usr/local/tomcat
RUN rm /tmp/apache-tomcat-7.0.61.tar.gz
# Download Maven
RUN wget -O /tmp/apache-maven-3.1.1-bin.tar.gz http://ftp.jaist.ac.jp/pub/apache/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.tar.gz
RUN cd /usr/local && tar xzf /tmp/apache-maven-3.1.1-bin.tar.gz
RUN ln -s /usr/local/apache-maven-3.1.1 /usr/local/maven
RUN rm /tmp/apache-maven-3.1.1-bin.tar.gz
# Install Vim
RUN yum install vim -y
# Copy nginx config file and delete conflicting conf
ADD ./nginx-conf /etc/nginx/conf.d
RUN rm -f /etc/nginx/conf.d/default.conf
# Copy start script
ADD ./start-script /usr/local
RUN chmod a+x /usr/local/start-everything.sh
# Clone the application itself
#RUN -v /bin/cloud:/usr/local
ADD ./app /usr/local
# Environment variables
ENV JAVA_HOME /usr/java/latest
ENV CATALINA_HOME /usr/local/tomcat
ENV MAVEN_HOME /usr/local/maven
ENV APP_HOME /usr/local/run
# Build the app once, so we can include all the dependencies in the image
RUN cd /usr/local/run/ninja-sample && /usr/local/maven/bin/mvn -Dmaven.test.skip=true package
# Set the start script as the default command (this will be overriden if a command is passed to Docker on the commandline).
# Note that we tail Tomcat's log in order to keep the process running
# so that Docker will not shutdown the container. This is a bit of a hack.
CMD /usr/local/start-everything.sh && tail -F /usr/local/tomcat/logs/catalina.out
# Forward HTTP ports
EXPOSE 80 8080