forked from joepurdy/DockPress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
develop
executable file
·58 lines (53 loc) · 1.55 KB
/
develop
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
56
57
58
#!/usr/bin/env bash
# Set environment variables for local
export APP_PORT=${APP_PORT:-80}
export APP_PORT_SECURE=${APP_PORT_SECURE:-443}
export DB_HOST=${DB_HOST:-database}
export DB_PORT=${DB_PORT:-3306}
export DB_ROOT_PASS=${DB_ROOT_PASS:=secret}
export DB_NAME=${DB_NAME:=wordpress}
export DB_USER=${DB_USER:=wordpress}
export DB_PASS=${DB_PASS:=secret}
# Environment
COMPOSE_FILE="dev"
COMPOSE="docker-compose -f docker-compose.$COMPOSE_FILE.yml"
if [ $# -gt 0 ]; then
# If "composer" is used, pass-thru to "composer"
# inside a new container
if [ "$1" == "composer" ]; then
shift 1
$COMPOSE run --rm $TTY \
-w /var/www/html \
web \
composer "$@"
# If "wp" is used, pass-thru to "wp-cli"
elif [ "$1" == "wp" ]; then
shift 1
$COMPOSE run --rm $TTY \
-w /var/www/html \
web \
wp --allow-root "$@"
# if "init" is used, make the src directory and
# install latest version of Bedrock. Afterwards
# install a Sage theme into Bedrock's theme folder
# with the name specified as the argument after "init".
# By default the dev-master version of Sage will
# be used.
elif [ "$1" == "init" ]; then
shift 1
mkdir src
$COMPOSE run --rm $TTY \
-w /var/www/html \
web \
composer create-project roots/bedrock .
$COMPOSE run --rm $TTY \
-w /var/www/html/web/app/themes \
web \
composer create-project roots/sage $1 dev-master
# Else, pass-thru args to docker-compose
else
$COMPOSE "$@"
fi
else
$COMPOSE ps
fi