Using Dockerfile to build a Java compilation environment, here is the implementation step:
1, including the following software packages
- Ubuntu
- Jdk
- Maven
- Svn
2, JDK, maven need to manually download, after downloading for
Jdk-8u51-linux-x64.gz
Apache-maven-3.3.3-bin.tar.gz
3, create a dockerfile file, including the following content
From Ubuntu
run Apt-get update
run apt-get-y install subversion
ADD jdk-8u51-linux-x64.gz/usr/local
ADD apache-maven-3.3.3-bin.tar.gz/usr/local
env java_home/usr/local/jdk1.8.0_51
env m2_home/usr/local/ apache-maven-3.3.3
ENV PATH $PATH: $JAVA _home/bin: $M 2_home/bin
To put it simply, create a mirror based on Ubuntu, then update the software source, then install SVN, then add the downloaded JDK, maven to the mirror, and place it in the/usr/local directory, where I add a compression package that is suitable for mirroring, The system will automatically decompress, and the mirror will not have compressed files, and finally set the environment variable
4, finally began to build a mirror
Docker Build-t Dev.
After the build, you can use Docker images see a mirror called Dev, this is what we created, here to note that the Dockerfile file with the previous download of the compressed package is in the same directory, Also make sure that you are in the Dockerfile directory when you run the package command above.
5, start
Docker run-i-T Dev
After starting, input Java, MVN, SVN, is not all installed, then you can in this container to download the code from SVN, and then packaged with MAVEN, and then deployed to the container containing Tomcat.
Thank you for reading, I hope to help you, thank you for your support for this site!