Skip to content

aballaci/maven-docker-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

Maven Dependencies Proxy for Docker Multistage Builds

Local maven cache setup

This approach is 3-4 times faster then anything i've tried e.g RUN mvn dependency:go-offline

The most portable solution till now seems to be a local nexus image running locally proxying the dependency downloads.

The problem with a prepackaged image that already has the dependencies is that you will have to first rebuild the image builder before you run your multistage maven build for the project.

Pull the image

$ docker pull sonatype/nexus3

Create a persistent volume:

$ docker volume create --name nexus-data

Run the image $ docker run -d -p 8081:8081 --name nexus -v nexus-data:/nexus-data sonatype/nexus3

Get in the container console: docker exec -it <container-id> bash

cat /nexus-data/admin.password

Create a Repository Group

add a settings file that mirrors all repos and points them to the Repository Group

in your Dockerfile copy the settings file

COPY settings.xml "/root/.m2/settings.xml" ...

Nexus 3 step by step proxy

here you can finde an example for a springboot application that uses a skaffold build for the local Kubernetes Cluster. github project

screenshot

Releases

No releases published

Packages

No packages published