New profile 'wildfly-docker-maven' for testing with rhuss/docker-maven-plugin #297
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This profile demonstrates the usage of docker-maven-plugin for starting a Docker container for integration tests (without Arquillian). It has been tested with the example 'simple-servlet', for which the single unit test has be duplicated to work without Arquillian. The profile uses the
maven-failsafe-plugin
(triggered on*IT.java
classes) and switched offmaven-surefire-plugin
so that the two tests don't interfere.The image created contains the deployment artifact already which is copied to
/opt/wildfly/standalone/deployments
so no extra deployment step is required.To test it simply call:
(assuming your DOCKER_HOST variable is set properly). One can also build the image, start and stop it separately:
It use dynamically assigned ports, so multiples test can be run in parallel.
Please note that its quite simplistic and doesn't use all feature of the plugin. Some comments has been added inline to explain the various pieces, for more information please refer to the user manual
What is not shown is how to push the combined image to a registry with
docker:push
. For this to work, the credentials should be added to~/.m2/settings.xml
and the name of the image should be adapted accordingly to the docker hub conventions (user/repo:tag)