store production build in environment
This commit is contained in:
parent
0c2d560947
commit
b3c4d70475
5 changed files with 11 additions and 9 deletions
4
build
4
build
|
@ -8,11 +8,11 @@ env/bin/pip install -r requirements.txt --upgrade
|
||||||
scripts/get-private-data.sh
|
scripts/get-private-data.sh
|
||||||
|
|
||||||
npm install
|
npm install
|
||||||
npm run build
|
npm run build $@
|
||||||
|
|
||||||
env/bin/python manage.py collectstatic --noinput
|
env/bin/python manage.py collectstatic --noinput
|
||||||
|
|
||||||
if [[ $@ == prod ]]
|
if [ $BUILD_PRODUCTION == "true" ]
|
||||||
then
|
then
|
||||||
echo ">> Running Migrations..."
|
echo ">> Running Migrations..."
|
||||||
env/bin/python manage.py migrate
|
env/bin/python manage.py migrate
|
||||||
|
|
|
@ -5,10 +5,11 @@ machine:
|
||||||
DEBUG: true
|
DEBUG: true
|
||||||
DATABASE_URL: sqlite://~/database.db
|
DATABASE_URL: sqlite://~/database.db
|
||||||
EMAIL_BACKEND: django.core.mail.backends.console.EmailBackend
|
EMAIL_BACKEND: django.core.mail.backends.console.EmailBackend
|
||||||
|
BUILD_PRODUCTION: true
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
pre:
|
pre:
|
||||||
- ./build prod
|
- ./build
|
||||||
cache_directories:
|
cache_directories:
|
||||||
- env
|
- env
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
DEBUG=false
|
DEBUG=false
|
||||||
DATABASE_URL=sqlite://~/database.db
|
DATABASE_URL=sqlite://~/database.db
|
||||||
EMAIL_BACKEND=django.core.mail.backends.smtp.EmailBackend
|
EMAIL_BACKEND=django.core.mail.backends.smtp.EmailBackend
|
||||||
|
BUILD_PRODUCTION=true
|
||||||
|
|
|
@ -2,14 +2,14 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [[ $@ == prod ]]
|
if [ $BUILD_PRODUCTION == "true" ]
|
||||||
then
|
then
|
||||||
echo ">>> WARNING: Building in Production Mode!"
|
echo ">>> WARNING: Building in Production Mode!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p static/build/js/lib
|
mkdir -p static/build/js/lib
|
||||||
|
|
||||||
if [[ $@ == prod ]]
|
if [ $BUILD_PRODUCTION == "true" ]
|
||||||
then
|
then
|
||||||
echo ">> Compressing Libraries..."
|
echo ">> Compressing Libraries..."
|
||||||
uglifyjs node_modules/bootstrap/dist/js/bootstrap.js --compress --screw-ie8 --define --stats --keep-fnames -o static/build/js/lib/bootstrap.js
|
uglifyjs node_modules/bootstrap/dist/js/bootstrap.js --compress --screw-ie8 --define --stats --keep-fnames -o static/build/js/lib/bootstrap.js
|
||||||
|
@ -22,7 +22,7 @@ fi
|
||||||
|
|
||||||
rm -rf static/build/js/lib
|
rm -rf static/build/js/lib
|
||||||
|
|
||||||
if [[ $@ == prod ]]
|
if [ $BUILD_PRODUCTION == "true" ]
|
||||||
then
|
then
|
||||||
echo ">> Compressing jQuery..."
|
echo ">> Compressing jQuery..."
|
||||||
uglifyjs node_modules/jquery/dist/jquery.js --compress --screw-ie8 --define --stats --keep-fnames -o static/build/js/jquery.js
|
uglifyjs node_modules/jquery/dist/jquery.js --compress --screw-ie8 --define --stats --keep-fnames -o static/build/js/jquery.js
|
||||||
|
@ -35,7 +35,7 @@ fi
|
||||||
echo ">> Building Application JS..."
|
echo ">> Building Application JS..."
|
||||||
browserify -t [ babelify --presets [ es2015 react ] ] static/src/js/app.js -o static/build/js/app.js
|
browserify -t [ babelify --presets [ es2015 react ] ] static/src/js/app.js -o static/build/js/app.js
|
||||||
|
|
||||||
if [[ $@ == prod ]]
|
if [ $BUILD_PRODUCTION == "true" ]
|
||||||
then
|
then
|
||||||
echo ">> Compressing Application..."
|
echo ">> Compressing Application..."
|
||||||
uglifyjs static/build/js/app.js --compress --screw-ie8 --define --stats --keep-fnames -o static/build/js/app.js
|
uglifyjs static/build/js/app.js --compress --screw-ie8 --define --stats --keep-fnames -o static/build/js/app.js
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [[ $@ == prod ]]
|
if [ $BUILD_PRODUCTION == "true" ]
|
||||||
then
|
then
|
||||||
echo ">>> WARNING: Building in Production Mode!"
|
echo ">>> WARNING: Building in Production Mode!"
|
||||||
fi
|
fi
|
||||||
|
@ -10,7 +10,7 @@ fi
|
||||||
echo ">> Building LESS..."
|
echo ">> Building LESS..."
|
||||||
lessc --silent static/src/less/style.less static/build/css/style.css
|
lessc --silent static/src/less/style.less static/build/css/style.css
|
||||||
|
|
||||||
if [[ $@ == prod ]]
|
if [ $BUILD_PRODUCTION == "true" ]
|
||||||
then
|
then
|
||||||
echo ">> Compressing LESS..."
|
echo ">> Compressing LESS..."
|
||||||
cleancss -d --s0 -o static/build/css/style.css static/build/css/style.css
|
cleancss -d --s0 -o static/build/css/style.css static/build/css/style.css
|
||||||
|
|
Reference in a new issue