wiremock / wiremock-docker

Wiremock Docker image
https://hub.docker.com/r/wiremock/wiremock
MIT License
218 stars 101 forks source link

Wiremock Extensions #3

Closed adilfulara closed 7 years ago

adilfulara commented 7 years ago

How does one use wiremock extensions with this image? If i mount a volume with the extensions jar how would the docker image pick it up ?

rodolpheche commented 7 years ago

Override the default command to add your binded jar to the java classpath : docker run -d -v $PWD/extensions/your-extension.jar:/your-extension.jar rodolpheche/wiremock java -cp "/your-extension.jar:/wiremock-standalone.jar" com.github.tomakehurst.wiremock.standalone.WireMockServerRunner --extensions your.applicaton.extension.Transformer

rodolpheche commented 7 years ago

Did you successfully run wiremock with extension using the command above?

adilfulara commented 7 years ago

sorry I didn't. I actually packaged my extensions with wiremock based so that i could use it elsewhere without volume mounts. but i did exactly what you recommended :)

java -cp "/home/*" "com.github.tomakehurst.wiremock.standalone.WireMockServerRunner" --extensions co.foo.MyExtensions
rodolpheche commented 7 years ago

I made it easier to use with the latest image.

Now, the default command automatically includes a specific folder (/var/wiremock/extensions) in the java classpath. You just have to copy/bind your extension jar into this folder and run the container with --extensions co.foo.MyExtensions

I wrote an example on how to do here : https://github.com/rodolpheche/wiremock-docker#use-wiremock-extensions

rodolpheche commented 7 years ago

Did you try with the latest image ?