Difference between revisions of "JHipster"

From BITPlan Wiki
Jump to navigation Jump to search
Line 1: Line 1:
 
= Scripts =
 
= Scripts =
 
== docker run script ==
 
== 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 ===
 
=== example ===
 
<source lang='bash'>
 
<source lang='bash'>
Line 47: Line 51:
 
fi
 
fi
 
</source>
 
</source>
 +
 
= Links =
 
= Links =
 
* https://www.jhipster.tech/installation/
 
* https://www.jhipster.tech/installation/
 
* https://stackoverflow.com/questions/tagged/jhipster
 
* https://stackoverflow.com/questions/tagged/jhipster
 
* https://www.jhipster.tech/docker-compose/
 
* https://www.jhipster.tech/docker-compose/

Revision as of 11:28, 26 December 2018

Scripts

docker run script

the run script has no options and will

  1. pull the jhipster docker image (only once)
  2. run the jhipster docker container (only once)
  3. 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

Links