-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-entrypoint.sh
81 lines (55 loc) · 2.03 KB
/
docker-entrypoint.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
# Allows WP CLI to run with the right permissions.
wp-su() {
sudo -E -u www-data wp "$@"
}
install_gravity_forms() {
rm -rf /wp-core/wp-content/plugins/gravityforms
echo "Grabbing the latest development master of Gravity Forms."
git clone -b master --single-branch https://[email protected]/gravityforms/gravityforms.git /wp-core/wp-content/plugins/gravityforms
cd /wp-core/wp-content/plugins/gravityforms
npm install -g grunt-cli && \
npm install && \
npm run release
}
install_gravity_flow() {
rm -rf /wp-core/wp-content/plugins/gravityflow
echo "Grabbing the latest development master of Gravity Flow."
git clone -b master --single-branch https://[email protected]/gravityforms/gravityflow.git /wp-core/wp-content/plugins/gravityflow
cd /wp-core/wp-content/plugins/gravityflow
npm install && \
npm run release
}
# Clean up from previous tests
rm -rf /wp-core/wp-content/uploads/gravity_forms
# Make sure permissions are correct.
echo 'Setting permissions'
cd /wp-core
chmod 755 wp-content
chown www-data:www-data wp-content
chown www-data:www-data wp-content/plugins
export WP_CLI_CACHE_DIR=/wp-core/.wp-cli/cache
# Make sure the database is up and running.
while ! mysqladmin ping -hmysql --silent; do
echo 'Waiting for the database'
sleep 1
done
echo 'The database is ready'
# Make sure WordPress is installed.
if ! $(wp-su core is-installed); then
echo "Installing WordPress"
wp-su core install --url=wordpress --title=tests --admin_user=admin [email protected]
# The development version of Gravity Flow requires SCRIPT_DEBUG
wp-su core config --dbhost=mysql --dbname=wordpress --dbuser=root --dbpass=wordpress --extra-php="define( 'SCRIPT_DEBUG', true );" --force
install_gravity_forms
install_gravity_flow
else
if [[ ${NO_CACHE_GRAVITY_FORMS} == '1' ]]; then
install_gravity_forms
fi
if [[ ${NO_CACHE_GRAVITY_FLOW} == '1' ]]; then
install_gravity_flow
fi
fi
cd /project
exec "codecept" "$@"