• LOGIN
  • No products in the cart.

DevOps on AWS – Docker Image file for Maven

# Dockerfile
FROM rns/oracle-java:8

ENV MAVEN_VERSION 3.3.9

RUN apt-get install curl
RUN mkdir -p /usr/share/maven
  && curl -fsSL http://apache.osuosl.org/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz
    | tar -xzC /usr/share/maven –strip-components=1
  && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn

ENV MAVEN_HOME /usr/share/maven

VOLUME /root/.m2

CMD [“mvn”] 


Cmds:

Build the Maven Image:

docker build -f Dockerfile-Maven -t rns/maven:3.3-jdk-8 .

Create a Project:

docker run -it –rm -v “$PWD”:/app -w /app rns/maven:3.3-jdk-8 mvn archetype:generate -DgroupId=com.rns.app -DartifactId=rns-app -DarchetypeArtifactId=maven-archetype-quickstart -Dinte

cd  my-app

Package it:

docker run -it –rm -v “$PWD”:/app -w /app rns/maven:3.3-jdk-8 mvn package

Run Program:


docker run -it –rm -v “$PWD”:/app -w /app rns/maven:3.3-jdk-8 java -cp target/rns-app-1.0.jar com.rns.app.App
February 22, 2021

0 responses on "DevOps on AWS - Docker Image file for Maven"

    All rights reserved.
    error: Alert: Content is protected !!
    X