Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
docker-php-starterkit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
docker-php-starterkit
Commits
3720642d
Commit
3720642d
authored
1 year ago
by
Axel Hahn
Browse files
Options
Downloads
Patches
Plain Diff
simplyfy console command; add php linter
parent
d5094135
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docker/init.sh
+50
-16
50 additions, 16 deletions
docker/init.sh
with
50 additions
and
16 deletions
docker/init.sh
+
50
−
16
View file @
3720642d
...
...
@@ -4,16 +4,17 @@
# DOCKER PHP DEV ENVIRONMENT :: INIT
#
# ----------------------------------------------------------------------
# 2021-11-nn v1.0 <axel.hahn@iml.unibe.ch>
# 2022-07-19 v1.1 <axel.hahn@iml.unibe.ch> support multiple dirs for setfacl
# 2022-11-16 v1.2 <www.axel-hahn.de> use docker-compose -p "$APP_NAME"
# 2022-12-18 v1.3 <www.axel-hahn.de> add -p "$APP_NAME" in other docker commands
# 2022-12-20 v1.4 <axel.hahn@unibe.ch> replace fgrep with grep -F
# 2023-03-06 v1.5 <www.axel-hahn.de> up with and without --build
# 2023-08-17 v1.6 <www.axel-hahn.de> menu selection with single key (without return)
# 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
# 2021-11-nn v1.0 <axel.hahn@iml.unibe.ch>
# 2022-07-19 v1.1 <axel.hahn@iml.unibe.ch> support multiple dirs for setfacl
# 2022-11-16 v1.2 <www.axel-hahn.de> use docker-compose -p "$APP_NAME"
# 2022-12-18 v1.3 <www.axel-hahn.de> add -p "$APP_NAME" in other docker commands
# 2022-12-20 v1.4 <axel.hahn@unibe.ch> replace fgrep with grep -F
# 2023-03-06 v1.5 <www.axel-hahn.de> up with and without --build
# 2023-08-17 v1.6 <www.axel-hahn.de> menu selection with single key (without return)
# 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
echo
-n
"id or name >"
read
dockerid
test
-z
"
$dockerid
"
||
docker
exec
-it
$dockerid
/bin/bash
_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
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 ..."
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment