33 lines
1.1 KiB
Makefile
Executable File
33 lines
1.1 KiB
Makefile
Executable File
VERSION:=$(shell git describe --always)
|
|
TARGET_ENV ?= dev
|
|
|
|
build: dist/hff-entry-forms-api.tar.gz dist/hff-entry-forms-web.tar.gz
|
|
|
|
clean:
|
|
-rm -r dist
|
|
-rm -r web/dist
|
|
-docker container prune
|
|
-docker image prune
|
|
|
|
update-version:
|
|
operations/update-version.sh
|
|
|
|
dist/hff-entry-forms-web.tar.gz:
|
|
-mkdir dist
|
|
TARGET_ENV=$(TARGET_ENV) make -C web build
|
|
tar czf dist/hff-entry-forms-web-${VERSION}.tar.gz -C web/dist .
|
|
cp dist/hff-entry-forms-web-${VERSION}.tar.gz dist/hff-entry-forms-web.tar.gz
|
|
|
|
deploy-api:
|
|
make -C api build-image push-image
|
|
cd operations/terraform && terraform apply -target module.${TARGET_ENV}_env.aws_ecs_task_definition.hff_entry_forms_api -target module.${TARGET_ENV}_env.aws_ecs_service.hff_entry_forms_api
|
|
|
|
deploy-web: dist/hff-entry-forms-web.tar.gz
|
|
mkdir -p temp-deploy/hff-entry-forms-web-${VERSION}
|
|
tar xzf dist/hff-entry-forms-web-${VERSION}.tar.gz -C temp-deploy/hff-entry-forms-web-${VERSION}
|
|
aws s3 sync temp-deploy/hff-entry-forms-web-${VERSION} s3://forms.hopefamilyfellowship.com/$(TARGET_ENV)/webroot
|
|
TARGET_ENV=${TARGET_ENV} operations/invalidate-cdn-cache.sh
|
|
rm -r temp-deploy
|
|
|
|
deploy: deploy-api deploy-web
|