JHipster

From BITPlan Wiki
Revision as of 11:27, 26 December 2018 by Wf (talk | contribs)
Jump to navigation Jump to search

Scripts

docker run script

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