39 lines
1.6 KiB
Makefile
39 lines
1.6 KiB
Makefile
VERSION:=$(shell git describe --always)
|
|
TARGET_ENV?=dev
|
|
|
|
build: dist/personal-measure-api.tar.gz dist/personal-measure-web.tar.gz
|
|
|
|
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
|
|
|
|
dist/personal-measure-web.tar.gz:
|
|
-mkdir dist
|
|
(TARGET_ENV=$(TARGET_ENV) ./set-env.sh make -C web 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: 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}
|
|
-ssh pmapi@pmapi.jdb-labs.com "sudo systemctl stop personal_measure_api.$(TARGET_ENV).service"
|
|
scp temp-deploy/personal-measure-api-${VERSION}/personal_measure_api pmapi@pmapi.jdb-labs.com:/home/pmapi/$(TARGET_ENV)/personal_measure_api
|
|
ssh pmapi@pmapi.jdb-labs.com "sudo systemctl start personal_measure_api.$(TARGET_ENV).service"
|
|
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://pm.jdb-labs.com/$(TARGET_ENV)/webroot
|
|
TARGET_ENV=${TARGET_ENV} operations/invalidate-cdn-cache.sh
|
|
rm -r temp-deploy
|
|
|
|
deploy: deploy-api deploy-web
|
|
|
|
clean:
|
|
-rm -r dist
|
|
-rm api/personal_measure_api
|
|
-rm -r web/dist
|