Add build and deploy targets to top-level Makefile.

This commit is contained in:
Jonathan Bernard 2019-05-18 17:45:43 -05:00
parent 1d544dad0b
commit d88689ee31

View File

@ -1,15 +1,29 @@
VERSION=`git describe --always`
VERSION:=$(shell git describe --always)
build: build-api build-web
build: dist/personal-measure-api.tar.gz dist/personal-measure-web.tar.gz
build-api:
dist/personal-measure-api.tar.gz:
-mkdir dist
make -C api personal_measure_api
tar czf dist/personal-measure-api-${VERSION}.tar.gz -C api personal_measure_api
cp dist/personal-measure-api-${VERSION}.tar.gz dist/personal-measure-api.tar.gz
build-web:
dist/personal-measure-web.tar.gz:
-mkdir dist
(cd web && npm run build)
tar czf dist/personal-measure-web-${VERSION}.tar.gz -C web/dist .
cp dist/personal-measure-web-${VERSION}.tar.gz dist/personal-measure-web.tar.gz
#deploy-api: build-api
deploy-api: dist/personal-measure-api.tar.gz
mkdir -p temp-deploy/personal-measure-api-${VERSION}
tar xzf dist/personal-measure-api-${VERSION}.tar.gz -C temp-deploy/personal-measure-api-${VERSION}
scp temp-deploy/personal-measure-api-${VERSION}/personal_measure_api pmapi@pmapi.jdbernard.com:/home/pmapi/personal_measure_api
rm -r temp-deploy
deploy-web: dist/personal-measure-web.tar.gz
mkdir -p temp-deploy/personal-measure-web-${VERSION}
tar xzf dist/personal-measure-web-${VERSION}.tar.gz -C temp-deploy/personal-measure-web-${VERSION}
aws s3 sync temp-deploy/personal-measure-web-${VERSION} s3://personal-measure.jdbernard.com
rm -r temp-deploy
deploy: deploy-api deploy-web