-
Notifications
You must be signed in to change notification settings - Fork 3
/
start.sh
55 lines (48 loc) · 1.27 KB
/
start.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
# The current Version of this file can be found HERE:
# https://github.com/pluswerk/php-dev/blob/master/start.sh
[ -f .env ] && . .env
CONTEXT=${CONTEXT:-Development}
USER=${APPLICATION_UID:-1000}:${APPLICATION_GID:-1000}
if [ -z "$SSH_AUTH_SOCK" ]
then
SSH_AGENT_PART=
else
SSH_AGENT_PART="-v $(dirname $SSH_AUTH_SOCK):$(dirname $SSH_AUTH_SOCK) -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK"
fi
function startFunction {
key="$1"
case ${key} in
start)
startFunction pull && \
startFunction build && \
startFunction up && \
startFunction login
return
;;
up)
docker-compose up -d --remove-orphans
return
;;
down)
docker-compose down --remove-orphans
return
;;
login)
docker-compose exec companion sh
return
;;
# this is useful if you need to have your ssh-agent available for executing a command e.g composer install
# example usage: bash start.sh run-with-agent -T web composer install --no-dev --ansi --verbose
run-with-agent)
docker-compose run --rm --entrypoint= $SSH_AGENT_PART ${@:2}
return
;;
*)
docker-compose "${@:1}"
return
;;
esac
}
startFunction "${@:1}"
exit $?