-
Notifications
You must be signed in to change notification settings - Fork 388
/
build.sh
executable file
·74 lines (59 loc) · 1.75 KB
/
build.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
#!/bin/sh
set -u
set -e
export COMPOSER_ALLOW_SUPERUSER=1
export COMPOSER_NO_INTERACTION=1
# The user when provisioning is different than the user running actual php workers (in production).
if [ -z "${OSU_SKIP_CACHE_PERMISSION_OVERRIDE:-}" ]; then
# Don't fail if permissions don't get set on all files.
chmod -R 777 storage bootstrap/cache || true
fi
if [ -z "${OSU_USE_SYSTEM_COMPOSER:-}" ]; then
COMPOSER="php composer.phar"
if [ -f composer.phar ]; then
php composer.phar self-update --2
else
curl -sL "https://getcomposer.org/download/latest-2.x/composer.phar" > composer.phar
fi
else
COMPOSER="composer"
fi
if [ -n "${GITHUB_TOKEN:-}" ]; then
${COMPOSER} config -g github-oauth.github.com "${GITHUB_TOKEN}"
fi
rm -f bootstrap/cache/*.php bootstrap/cache/*.json
if [ -z "${OSU_INSTALL_DEV:-}" ]; then
${COMPOSER} install --no-dev
else
${COMPOSER} install
fi
php artisan view:clear
if [ -n "${OSU_DB_CREATE:-}" ]; then
php artisan db:create
fi
# e.g. OSU_SKIP_DB_MIGRATION=1 ./build.sh to bypass running migrations
if [ -z "${OSU_SKIP_DB_MIGRATION:-}" ]; then
php artisan migrate --force
else
echo "OSU_SKIP_DB_MIGRATION set, skipping DB migration."
fi
if [ -z "${PASSPORT_PUBLIC_KEY:-}" ]; then
php artisan passport:keys
fi
# e.g. OSU_SKIP_ASSET_BUILD=1 ./build.sh to bypass building javascript assets
if [ -z "${OSU_SKIP_ASSET_BUILD:-}" ]; then
if [ ! -d node_modules ]; then
mkdir -p ~/node_modules
ln -snf ~/node_modules node_modules
fi
command -v yarn || npm install -g yarn
if [ -z "${OSU_INSTALL_DEV:-}" ]; then
yarn --prod --ignore-optional --frozen-lockfile
else
yarn
fi
yarn run production
else
echo "OSU_SKIP_ASSET_BUILD set, skipping javascript asset build."
fi
php artisan ip2asn:update