Last active
December 27, 2018 06:44
-
-
Save WolfgangFahl/900b438ea89dfb1e8e19ce138d6ffac1 to your computer and use it in GitHub Desktop.
jhipster docker helper scripts
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
#!/bin/bash | |
# see http://wiki.bitplan.com/index.php/JHipster for description | |
# WF 2018-12-26 | |
# run a bash shell in the jhipster docker image | |
docker exec -it jhipster /bin/bash |
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
#!/bin/bash | |
# WF 2018-12-26 | |
# see http://wiki.bitplan.com/index.php/JHipster for description | |
# see https://www.jhipster.tech/installation/ | |
# how many jhipster images have been installed? | |
# check how many lines the image command creates | |
imagecount=$(docker images jhipster/jhipster | wc -l) | |
#REPOSITORY TAG IMAGE ID CREATED SIZE | |
#jhipster/jhipster latest 71562063f279 4 days ago 1.04GB | |
# substract the repository line | |
imagecount=$(($imagecount-1)) | |
echo "found $imagecount jhipster image(s)" | |
# if there is no image yet - get it | |
if [ $imagecount -eq 0 ] | |
then | |
echo "pulling jhipster image" | |
docker image pull jhipster/jhipster | |
fi | |
jhipsterhome=~/jhipster | |
if [ ! -d $jhipsterhome ] | |
then | |
echo "creating $jhipsterhome" | |
mkdir $jhipsterhome | |
fi | |
echo "checking whether jhipster container exists" | |
container=$(docker ps -a -q --filter="name=jhipster") | |
if [ "$container" = "" ] | |
then | |
echo "running jhipster container" | |
docker container run --name jhipster -v ~/jhipster:/home/jhipster/app -v ~/.m2:/home/jhipster/.m2 -p 8080:8080 -p 9000:9000 -p 3001:3001 -d -t jhipster/jhipster | |
else | |
echo "checking whether jhipster container $container runs" | |
running=$(docker ps -q --filter="id=$container") | |
if [ "$running" = "" ] | |
then | |
echo "starting jhipster container $container" | |
docker start $container | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment