Docker Java Compilation environment construction detailed introduction _docker

Source: Internet
Author: User

Using Dockerfile to build a Java compilation environment, here is the implementation step:

1, including the following software packages

    1. Ubuntu
    2. Jdk
    3. Maven
    4. 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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.