Created
August 27, 2018 07:34
-
-
Save asafmaoz1234/e9da70ee1ce829d83f636f42f8dd894e to your computer and use it in GitHub Desktop.
update local running docker - stop if failing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "########## - updating continaer - ##########" | |
cd ~/sandbox/continaer | |
build_c="$(mvn clean install -DskipTests | grep FAILURE)" | |
if [ "$build_c" ] | |
then | |
echo "########## - Build failed - can not continue - ##########" | |
exit | |
fi | |
echo "########## - after clean install - ##########" | |
docker exec image_name find /opt/tomcat/webapps/ -name 'war_prefix##*SNAPSHOT*' | xargs docker exec image_name rm -rf | |
list_jars="$(docker exec image_name ls -l /opt/tomcat/webapps/ | grep SNAPSHOT)" | |
if [ "$list_jars" ] | |
then | |
echo "########## - Could not remove snapshots from docker - can not continue - ##########" | |
exit | |
fi | |
cd ~/sandbox/central/target | |
docker cp container*.war image_name:/opt/tomcat/webapps/ | |
list_jars_again="$(docker exec image_name ls -l /opt/tomcat/webapps/ | grep SNAPSHOT)" | |
if [ "$list_jars_again" ] | |
then | |
echo "########## - Copied local jars into docker - ##########" | |
else | |
echo "########## - Could not Copy local jars into docker - can not continue - ##########" | |
exit | |
fi | |
docker restart image_name | |
cd ~/sandbox/container | |
echo "########## - Changes updated and Docker restarted - ##########" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment