Last active
January 9, 2021 05:40
-
-
Save mhemmings/8bce047f60d8891954f406add0ee255d to your computer and use it in GitHub Desktop.
EB Deploy Makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VERSION=$(shell git rev-parse --short HEAD) | |
DESC=$(shell git log -1 --pretty=%B) | |
BUCKET_NAME="your-eb-s3-bucket" | |
PROJECT_NAME=$(shell basename $(shell pwd)) | |
REGION="eu-west-1" | |
ifndef ENV | |
$(error No environment ENV is defined) | |
endif | |
test: | |
go fmt | |
go vet | |
go test | |
build: | |
GOOS=linux GOARCH=amd64 go build -o build/queue_processor main.go | |
archive: | |
zip -j $(VERSION).zip build/queue_processor Procfile | |
create_version: | |
aws s3 cp $(VERSION).zip s3://$(BUCKET_NAME)/$(PROJECT_NAME)/ | |
aws elasticbeanstalk create-application-version --application-name $(PROJECT_NAME) --description "$(DESC)" --version-label $(VERSION) --source-bundle S3Bucket=$(BUCKET_NAME),S3Key="$(PROJECT_NAME)/$(VERSION).zip" --region $(REGION) | |
update_environment: | |
aws elasticbeanstalk update-environment --environment-name $(ENV) --version-label $(VERSION) --region $(REGION) | |
clean: | |
rm -rf build/ $(VERSION).zip | |
deploy: test build archive create_version update_environment clean | |
.PHONY: test build archive create_version update_environment clean deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
queue_process: queue_processor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment