This is basically a two part question.
First I would like to know how I would go about creating a new repository on a Nexus3 container after the container starts up. I know the rough outline on what has to be done, I just dont know how to do it. Basically, two cURL requests have to be sent to the container AFTER it is ready. The cURL requests are as follows:
curl -X POST -u admin:admin123 --header 'Content-Type: application/json' \
http://127.0.0.1:8081/service/rest/v1/script \
-d '{"name":"newrepo","type":"groovy","content":"repository.createMavenHosted('\''new-repo'\'');"}'
curl -X POST -u admin:admin123 --header "Content-Type: text/plain" 'http://127.0.0.1:8081/service/rest/v1/script/newrepo/run'
(The above curl requests work when I manually send them via an app like Postman AFTER the container is ready. I am just unsure on how to make docker do it for me)
Secondly, I would like to know how to move artifacts to the newly created repository. Is there a location on the nexus3 image where I can just execute a COPY
command and just copy the required artifacts to the repository?
Below is part of my docker-compose.yml
version: "2.1"
services:
nexus:
container_name: nexus-container
image: sonatype/nexus3
ports:
- "8081:8081"
This is just part of the entire file as the entire file a bit bigger therefore I did not want to post the entire thing, but I can do so if needed.
Thanks for any assistance provided :)