forked from GolfenGuo/java-mysql-travel-sample
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (27 loc) · 957 Bytes
/
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
FROM maven:3-jdk-7
MAINTAINER Golfen Guo "[email protected]"
ENV CATALINA_HOME /usr/local/tomcat
ENV PATH $CATALINA_HOME/bin:$PATH
RUN mkdir -p "$CATALINA_HOME"
WORKDIR $CATALINA_HOME
ENV TOMCAT_MAJOR 7
ENV TOMCAT_VERSION 7.0.63
ENV TOMCAT_TGZ_URL https://www.apache.org/dist/tomcat/tomcat-$TOMCAT_MAJOR/v$TOMCAT_VERSION/bin/apache-tomcat-$TOMCAT_VERSION.tar.gz
RUN curl -sSL "$TOMCAT_TGZ_URL" -o tomcat.tar.gz \
&& tar -xf tomcat.tar.gz --strip-components=1 \
&& rm bin/*.bat \
&& rm tomcat.tar.gz*
# Prepare by downloading dependencies
WORKDIR /code
ADD pom.xml /code/pom.xml
RUN mvn -q dependency:resolve
# Adding source, compile and package into a WAR
ADD src /code/src
RUN mvn -q -DskipTests=true compile war:exploded
RUN rm -rf /usr/local/tomcat/webapps/ROOT/*
RUN cp -r target/travel-1.0.0/* $CATALINA_HOME/webapps/ROOT/
# Expose port
EXPOSE 8080
# Start Tomcat
WORKDIR $CATALINA_HOME
CMD ["catalina.sh", "run"]