-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
35 lines (28 loc) · 1.14 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
BERLIOZ_GROUP := udacity
BERLIOZ_NAME := fomotograph-api
DOCKER_REPO := docker.udacity.com/$(BERLIOZ_GROUP)/$(BERLIOZ_NAME)
SERVICE_NAME := $(BERLIOZ_NAME)
VERSION ?= $(shell git rev-parse --short HEAD)
CONDUCTOR_APP_ID := 37eb0c76-d759-11e6-bc82-dbb131c6e091
export
.PHONY: all build push test deploy
all: build
test:
docker-compose up -d --build && sleep 10
# docker-compose exec test curl http://app:4567/healthcheck
docker-compose exec test curl http://app:4567/products.json -o /tmp/test1
docker-compose exec test jq '.' /tmp/test1
docker-compose exec test curl http://app:4567/erasurez -o /tmp/test2
docker-compose exec test jq '.' /tmp/test2
docker-compose down
build:
docker build -t $(SERVICE_NAME) .
docker tag $(SERVICE_NAME) $(DOCKER_REPO):$(VERSION)
push:
docker push $(DOCKER_REPO):$(VERSION)
deploy: ENVIRONMENT=production
deploy: build push
# Deploy to Conductor
@curl --fail -X PUT "https://conductor-beta.udacity.com/api/v1/apps/$(CONDUCTOR_APP_ID)/deploy" \
-H 'X-GitHub-Access-Token: $(CI_GITHUB_ACCESS_TOKEN)' \
-d '{"environment": "$(ENVIRONMENT)", "image": "$(DOCKER_REPO):$(VERSION)"}'