JHipster
Jump to navigation
Jump to search
Scripts
docker run script
the run script has no options and will
- pull the jhipster docker image (only once)
- run the jhipster docker container (only once)
- restart the jhipster docker container (if not running)
example
./run
run
#!/bin/bash
# WF 2018-12-26
# 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
bash
example
./bashit
source
#!/bin/bash
# WF 2018-12-26
# run a bash shell in the jhipster docker image
docker exec -it jhipster /bin/bash