-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
33 lines (23 loc) · 1.43 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
GIT_HASH := v$(shell git rev-parse --short HEAD)
develop:
docker-compose -f .development/docker-compose.yml up -d
develop-logs:
docker-compose -f .development/docker-compose.yml logs -f
clean:
docker-compose -f .development/docker-compose.yml down
docker-login:
@eval "$(shell aws ecr get-login --region $(AWS_DEFAULT_REGION) --no-include-email)"
build: docker-login
docker build -t vmi:latest -f .docker/Dockerfile .
docker tag vmi "$(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_DEFAULT_REGION).amazonaws.com/vmi:$(GIT_HASH)"
docker push "$(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_DEFAULT_REGION).amazonaws.com/vmi:$(GIT_HASH)"
.deployment/Dockerrun.aws.json.sh $(GIT_HASH) | aws s3 cp - s3://vmi.$(ENVIRONMENT).bucket/$(GIT_HASH)/Dockerrun.aws.json
aws elasticbeanstalk create-application-version --application-name vmi-dev --version-label $(GIT_HASH) --description "Version created from gitlab ci" --source-bundle S3Bucket="vmi.$(ENVIRONMENT).bucket",S3Key="$(GIT_HASH)/Dockerrun.aws.json"
deploy:
aws elasticbeanstalk update-environment --environment-name vmi-$(ENVIRONMENT)-env --version-label $(GIT_HASH)
init:
.deployment/terraform init .deployment/
plan: init
.deployment/terraform plan -var 'environment=$(ENVIRONMENT)' -var 'version=$(GIT_HASH)' -var 'db_username=$(DB_USER)' .deployment/
infrastructure: plan
.deployment/terraform apply -auto-approve -var 'environment=$(ENVIRONMENT)' -var 'version=$(GIT_HASH)' -var 'db_username=$(DB_USER)' .deployment/