Building a Docker Java compilation environment

Source: Internet
Author: User

Build a Java compilation environment with Dockerfile

1. Include the following packages

    • Ubuntu
    • Jdk
    • Maven
    • Svn

2, JDK, maven need to download manually, after downloading for

    • Jdk-8u51-linux-x64.gz
    • Apache-maven-3.3.3-bin.tar.gz

3. Create a Dockerfile file with the following content

FROM ubuntuRUN apt-get updateRUN apt-get -y install subversionADD jdk-8u51-linux-x64.gz /usr/localADD apache-maven-3.3.3-bin.tar.gz /usr/localENV JAVA_HOME /usr/local/jdk1.8.0_51ENV M2_HOME /usr/local/apache-maven-3.3.3ENV PATH $PATH:$JAVA_HOME/bin:$M2_HOME/bin

Simply say the above meaning, is based on Ubuntu to create a mirror, then update the software source, then install SVN, and then add the downloaded JDK, maven to the image, and placed in the/usr/local directory, where I add a compressed package, in the construction of the image of the appropriate, The system will automatically unzip, and the image will not have compressed files, and then set the environment variable

4, finally start to build the mirror

docker build -t dev .

After the build, you can use Docker images to see an image called Dev, this is what we created, it is important to note that the Dockerfile file is in the same directory as the previously downloaded compressed package, Also make sure the directory where the Dockerfile is located when running the above packaging commands.

5. Start

docker run -i -t dev

After startup, the input Java, MVN, SVN, is not all installed, then you can in this container to download the code from SVN, and then through MAVEN packaging, and then deployed to the container containing Tomcat.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Building a Docker Java compilation environment

Related Article

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.