diff --git a/java/8/Dockerfile b/java/8/Dockerfile index f193f9b..250db7e 100755 --- a/java/8/Dockerfile +++ b/java/8/Dockerfile @@ -1,7 +1,84 @@ +# docker build -t imqs/java-base:8-test --build-arg Maven_Nexus_User=$Maven_Nexus_User --build-arg Maven_Releases_Deployment=$Maven_Releases_Deployment --build-arg Maven_Snapshots_Deployment=$Maven_Snapshots_Deployment --build-arg Maven_Github_gerhardvanwyk=$Maven_Github_gerhardvanwyk . + FROM imqs/ubuntu-base -RUN apt-get update \ - && apt-get install openjdk-8-jre -y +RUN apt update && \ + apt install -y \ + openjdk-8-jdk \ + wget && \ + rm -rf /var/lib/apt/lists/* + +RUN wget https://www-us.apache.org/dist/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.tar.gz -P /tmp && \ + tar xf /tmp/apache-maven-*.tar.gz -C /opt && rm /tmp/apache-maven-*.tar.gz && \ + mv /opt/apache-maven-* /opt/maven +ENV MAVEN_HOME=/opt/maven +ENV PATH=${MAVEN_HOME}/bin:${PATH} + +ARG Maven_Nexus_User +ARG Maven_Releases_Deployment +ARG Maven_Snapshots_Deployment +ARG Maven_Github_gerhardvanwyk +RUN mkdir -p /root/.m2 +RUN echo " \ + \ + \ + \ + nexus \ + * \ + http://192.168.4.40:8081/nexus/content/groups/public \ + \ + \ + \ + \ + nexus \ + \ + \ + \ + \ + central \ + http://central \ + true \ + true \ + \ + \ + \ + \ + central \ + http://central \ + true \ + true \ + \ + \ + \ + \ + \ + \ + nexus \ + \ + \ + \ + \ + nexus \ + user \ + $Maven_Nexus_User \ + \ + \ + releases \ + deployment \ + $Maven_Releases_Deployment \ + \ + \ + snapshots \ + deployment \ + $Maven_Snapshots_Deployment \ + \ + \ + github \ + gerhardvanwyk \ + $Maven_Github_gerhardvanwyk \ + \ + \ +" > /root/.m2/settings.xml # Create a symlink to the real log directory RUN mkdir -p /imqsvar diff --git a/java/8/Dockerfile-local-m2 b/java/8/Dockerfile-local-m2 new file mode 100755 index 0000000..bceae5c --- /dev/null +++ b/java/8/Dockerfile-local-m2 @@ -0,0 +1,22 @@ +# docker build -t imqs/java-base:8-test . + +FROM imqs/ubuntu-base + +RUN apt update && \ + apt install -y \ + openjdk-8-jdk \ + wget && \ + rm -rf /var/lib/apt/lists/* + +RUN wget https://www-us.apache.org/dist/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.tar.gz -P /tmp && \ + tar xf /tmp/apache-maven-*.tar.gz -C /opt && rm /tmp/apache-maven-*.tar.gz && \ + mv /opt/apache-maven-* /opt/maven +ENV MAVEN_HOME=/opt/maven +ENV PATH=${MAVEN_HOME}/bin:${PATH} + +RUN mkdir -p /root/.m2 +COPY ./ /root/.m2 + +# Create a symlink to the real log directory +RUN mkdir -p /imqsvar +RUN ln -s /var/log/imqs /imqsvar/logs diff --git a/java/8/build-local-m2 b/java/8/build-local-m2 new file mode 100755 index 0000000..3facfbb --- /dev/null +++ b/java/8/build-local-m2 @@ -0,0 +1,6 @@ +dockerfileDir=${PWD} + +cd /home/`whoami`/.m2 && \ +sudo docker build -t imqs/java-base:8-test -f ${dockerfileDir}/Dockerfile-local-m2 . + +cd $dockerfileDir diff --git a/java/8/readme.md b/java/8/readme.md new file mode 100644 index 0000000..6ef49bf --- /dev/null +++ b/java/8/readme.md @@ -0,0 +1,10 @@ +# Docker Local m2 + +If you are a developer and you have made changes to your local .m2 folder and +you are not satisfied with just testing your service natively then this is the +dockerfile for you. + +By running the script called `build-local-m2` you can build the `java-base` +image using your own `.m2` folder in your home directory. You can then build +the docker image for java service and it will automatically use the local m2 +docker image as a base.