/docker-npm-maven-jf-yarn-git

alpine Dockerfile with docker ,npm ,11-jdk-alpine, maven ,git, jfrog cli ,yarn, localized to LANG=en_US.UTF-8, TZ=America/Los_Angeles

Primary LanguageDockerfile

docker-npm-maven-jf-yarn-git

alpine Dockerfile with docker ,npm ,11-jdk-alpine, maven ,git, jfrog cli ,yarn, localized to LANG=en_US.UTF-8, TZ=America/Los_Angeles

  1. Got the inspiration from https://github.com/cschockaert/docker-npm-maven/blob/master/Dockerfile

  2. Instead of starting with “FROM node:10-alpine” in Dockerfile used “FROM eclipse-temurin:11-jdk-alpine” as in 3.8.5-eclipse-temurin-11-alpine https://hub.docker.com/_/maven image

  3. For docker use 20.10.16-alpine3.15 tag's Dockerfile from https://hub.docker.com/_/docker but without the ENTRYPOINT ["docker-entrypoint.sh"]

  4. For git and localize see Dockerfile in step1

  5. Add the jfrog CLI

  6. For npm and yarn use 18-alpine3.14 from https://hub.docker.com/_/node

  7. For maven use 3.8.5-eclipse-temurin-11-alpine in https://hub.docker.com/_/maven along with the mvn-entrypoint.sh , settings-docker.xml

Build and push to Artifactory:

docker rmi -f soleng.jfrog.io/swampup2022-docker-local/docker20.10.16-npm18.1-maven3.8.5-jf2.16.4:11-jdk-alpine
docker build --tag soleng.jfrog.io/swampup2022-docker-local/docker20.10.16-npm18.1-maven3.8.5-jf2.16.4:11-jdk-alpine .
docker push soleng.jfrog.io/swampup2022-docker-local/docker20.10.16-npm18.1-maven3.8.5-jf2.16.4:11-jdk-alpine

Note: This image is 838 MB.

Usage:

docker run -it --rm --name my-maven-project -v "$(pwd)":/usr/src/mymaven -w /usr/src/mymaven  soleng.jfrog.io/swampup2022-docker-local/docker20.10.16-npm18.1-maven3.8.5-jf2.16.4:11-jdk-alpine mvn verify

docker run --rm --name my-project -it -v /var/run/docker.sock:/var/run/docker.sock soleng.jfrog.io/swampup2022-docker-local/docker20.10.16-npm18.1-maven3.8.5-jf2.16.4:11-jdk-alpine /bin/bash

docker run -it --rm --name my-project  -v /var/run/docker.sock:/var/run/docker.sock soleng.jfrog.io/swampup2022-docker-local/docker20.10.16-npm18.1-maven3.8.5-jf2.16.4:11-jdk-alpine docker ps

docker run -it --rm --name my-project  soleng.jfrog.io/swampup2022-docker-local/docker20.10.16-npm18.1-maven3.8.5-jf2.16.4:11-jdk-alpine npm -version

docker run -it --rm --name my-project  soleng.jfrog.io/swampup2022-docker-local/docker20.10.16-npm18.1-maven3.8.5-jf2.16.4:11-jdk-alpine jf --version

Note: Actually npm , maven , gradle, openjdk ( based on Temurin), sdkman, go is in the Full jfrog CLI v2.16.4 image ( not in the slim JFrog cli image) that is Ubuntu based ( hence image is 3.96 GB). The slim JFrog cli image is 53.6MB .

You can also mount your host ~/.m2 file to the docker container using the full path : For example for user joe on the host the mount path should be -v "/Users/joe/.m2":"/root/.m2" as shown below

docker run --rm --name my-project -it -v /var/run/docker.sock:/var/run/docker.sock -v "/Users/joe/.m2":"/root/.m2" -v "$(pwd)":/usr/src/mymaven -w /usr/src/mymaven soleng.jfrog.io/swampup2022-docker-local/docker20.10.16-npm18.1-maven3.8.5-jf2.16.4:11-jdk-alpine mvn validate compile test package