Skip to content
Snippets Groups Projects
Commit 9abab3aa authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

update docker init to 1.10

parent 997459cf
No related branches found
No related tags found
1 merge request!62V2.0
......@@ -14,6 +14,7 @@
# 2023-11-10 v1.7 <axel.hahn@unibe.ch> replace docker-compose with "docker compose"
# 2023-11-13 v1.8 <axel.hahn@unibe.ch> UNDO "docker compose"; update infos
# 2023-11-15 v1.9 <axel.hahn@unibe.ch> add help; execute multiple actions by params; new menu item: open app
# 2023-12-07 v1.10 <www.axel-hahn.de> simplyfy console command; add php linter
# ======================================================================
cd $( dirname $0 )
......@@ -22,7 +23,7 @@ cd $( dirname $0 )
# git@git-repo.iml.unibe.ch:iml-open-source/docker-php-starterkit.git
selfgitrepo="docker-php-starterkit.git"
_version="1.9"
_version="1.10"
# ----------------------------------------------------------------------
# FUNCTIONS
......@@ -56,6 +57,7 @@ function showMenu(){
echo " $( _key m ) - more infos"
echo " $( _key o ) - open app [${APP_NAME}] $frontendurl"
echo " $( _key c ) - console (bash)"
echo " $( _key p ) - console check with php linter"
echo
echo " $( _key q ) - quit"
}
......@@ -92,6 +94,7 @@ EXAMPLES:
$_self starts interactive mode
$_self u bring up docker container(s) and stay in interactive mode
$_self i q set write permissions and quit
$_self p q start php linter and exit
EOH
}
......@@ -304,7 +307,8 @@ function _key(){
# helper: wait for a return key
function _wait(){
echo -n "... press RETURN > "; read -r -t 15
local _wait=15
echo -n "... press RETURN ... or wait $_wait sec > "; read -r -t $_wait
}
# ----------------------------------------------------------------------
......@@ -378,10 +382,40 @@ while true; do
;;
c)
h2 "Console"
docker ps
_containers=$( docker-compose -p "$APP_NAME" ps | sed -n "2,\$p" | awk '{ print $1}' )
if [ "$DB_ADD" = "false" ]; then
dockerid=$_containers
else
echo "Select a container:"
echo "$_containers" | sed "s#^# #g"
echo -n "id or name >"
read dockerid
test -z "$dockerid" || docker exec -it $dockerid /bin/bash
fi
test -z "$dockerid" || (
echo
echo "> docker exec -it $dockerid /bin/bash (type 'exit' + Return when finished)"
docker exec -it $dockerid /bin/bash
)
;;
p)
h2 "PHP $APP_PHP_VERSION linter"
dockerid="${APP_NAME}-server"
echo -n "Scanning ... "
_iFiles=$( docker exec -it $dockerid /bin/bash -c "find . -name '*.php' " | wc -l )
if [ $_iFiles -gt 0 ]; then
echo "found $_iFiles [*.php] files ... errors from PHP $APP_PHP_VERSION linter:"
time if echo $APP_PHP_VERSION | grep -E "([567]\.|8\.[012])" >/dev/null ; then
docker exec -it $dockerid /bin/bash -c "find . -name '*.php' -exec php -l {} \; | grep -v '^No syntax errors detected'"
else
docker exec -it $dockerid /bin/bash -c "php -l \$( find . -name '*.php' ) | grep -v '^No syntax errors detected' "
fi
echo
_wait
else
echo "Start your docker container first."
fi
;;
o)
h2 "Open app ..."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment