I have a docker file, that creates an image of my automation project that runs maven to execute some tests, how can I copy something from docker back to host AFTER those tests were executed ? Simply adding copy command in Dockerfile, after ENTRYPOINT will start copying straight after executing first command from entrypoint command.
Dockerfile:
ADD src /usr/src/app/src/
ADD features /usr/src/app/features/
ADD Config.properties /usr/src/app/
ENTRYPOINT ["sh", "/usr/local/bin/mvn-entrypoint.sh"]
mvn-entrypoint.sh
#!/bin/bash
echo "PLEASE WAIT..."
sleep 10
echo "STARTING AUTOMATION TESTING"
mvn verify -q -D browser=chrome
exec "$@"
Use docker volume.
Run your container with docker run -v host/path:/temp imageID cp mvnOutputPath /temp
cp mvnOutputPath /temp is the docker command CMD, executed by exec "$@" in your entrypoint
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With