-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
executable file
·63 lines (44 loc) · 1.85 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
APP_NAME = designprototypes
# The value assigned here is for execution in local machines
# When executed by GoCD it may inject another value from a GoCD environment variable
AWS_ACCOUNT_ID=$(shell aws sts get-caller-identity --output text --query "Account" 2> /dev/null)
# GO_PIPELINE_COUNTER is the pipeline number, passed from our build agent.
GO_PIPELINE_COUNTER?="unknown"
# Construct the image tag.
VERSION=0.2.$(GO_PIPELINE_COUNTER)
# ECS-related
ECS_CLUSTER = ecs
AWS_REGION = eu-west-1
IMAGE = $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com/$(APP_NAME)
build:
docker build -t $(IMAGE):$(VERSION) -t $(IMAGE):latest .
# Container port 3000 is specified in Dockerfile
# Browse to http://localhost:80 to see the application
run:
docker run -p 80:3000 $(IMAGE)
dev:
docker run -p 80:3000 -v ${PWD}:/opt/$(APP_NAME) $(IMAGE)
test: build
docker run $(IMAGE) bundle exec rake
push:
docker push $(IMAGE):$(VERSION)
docker push $(IMAGE):latest
docker rmi $(IMAGE):$(VERSION)
docker rmi $(IMAGE):latest
# http://serverfault.com/questions/682340/update-the-container-of-a-service-in-amazon-ecs?rq=1
deploy-ecs:
# aws ecs register-task-definition --cli-input-json file://./aws_ecs/task-definition.json
./aws_ecs/register-task-definition.sh
aws ecs update-service --service $(APP_NAME) --cluster $(ECS_CLUSTER) --region $(AWS_REGION) --task-definition $(APP_NAME)
# Old targets kept for references: docker-compose, Docker Swarm, Docker Cloud, etc.
run-with-docker-compose:
docker-compose build
docker-compose up -d
run-docker-cloud:
docker-cloud stack up
runalone-docker-cloud:
docker-cloud stack up -f docker-cloud.standalone.yml
clean:
docker rmi $$(docker images -q)
deploy-swarm:
export DOCKER_HOST=$(DOCKER_SWARM_URL) && export IMAGE_NAME=$(IMAGE):$(VERSION) && docker-compose -f docker-compose.ci.yml down && docker-compose -f docker-compose.ci.yml up -d