operations: Add Makefiles and version-bumping script.
This commit is contained in:
32
Makefile
Executable file
32
Makefile
Executable file
@ -0,0 +1,32 @@
|
||||
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
|
Reference in New Issue
Block a user