forked from ppy/osu-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·58 lines (46 loc) · 1.47 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
#!/bin/sh
set -u
set -e
# 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 --1
else
curl -sL https://getcomposer.org/composer-1.phar > composer.phar
fi
else
COMPOSER="composer"
fi
# dummy user, no privilege github token to avoid github api limit
${COMPOSER} config -g github-oauth.github.com 98cbc568911ef1e060a3a31623f2c80c1786d5ff
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
# 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
php artisan passport:keys
# 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
yarn
yarn run production
else
echo "OSU_SKIP_ASSET_BUILD set, skipping javascript asset build."
fi