第1章 CentOS安装maven
[root@osb30 ~]# cd /usr/local/
[root@osb30 local]# wget http://apache.opencas.org/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
[root@osb30 local]# tar zxf apache-maven-3.3.9-bin.tar.gz
[root@osb30 local]# ln -s apache-maven-3.3.9 maven
[root@osb30 local]# vim /etc/profile
# 添加如下配置:
# Maven configuration.
MAVEN_HOME=/usr/local/maven
export PATH=$MAVEN_HOME/bin:$PATH
[root@osb30 local]# source /etc/profile
[root@osb30 local]# mvn -version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: /usr/local/maven
Java version: 1.8.0_65, vendor: Oracle Corporation
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-431.el6.x86_64", arch: "amd64", family: "unix"
1 构建maven_Dockerfile文件
cat Dockerfile
FROM centos:6.9
MAINTAINER hmk
ENV REFRESHED_AT 2018-07-21
WORKDIR /usr/local
RUN mkdir jdk
RUN mkdir tomcat
ADD apache-maven-3.3.9-bin.tar.gz /usr/local/
RUN ln -s /usr/local/apache-maven-3.3.9 /usr/local/maven
ADD jdk1.6.0_24.tar.gz /usr/local/jdk
ADD apache-tomcat-7.0.90.tar.gz /usr/local/tomcat
ENV JAVA_HOME=/usr/local/jdk/jdk1.6.0_24
ENV JRE_HOME=$JAVA_HOME/jre
ENV CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:$CLASSPATH
ENV MAVEN_HOME=/usr/local/maven
ENV PATH=/sbin:$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH
RUN chmod +x /usr/local/tomcat/apache-tomcat-7.0.90/bin/catalina.sh
EXPOSE 8080
ENTRYPOINT ["/usr/local/tomcat/apache-tomcat-7.0.90/bin/catalina.sh","run"]