This repository has been archived by the owner on Feb 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
62 lines (46 loc) · 1.9 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
VERSION :=`cat version.txt`
IMAGE := usgseros/lcmap-blackmagic
BRANCH := $(or $(TRAVIS_BRANCH),`git rev-parse --abbrev-ref HEAD`)
BRANCH := $(shell echo $(BRANCH) | tr / -)
BUILD_TAG := $(IMAGE):build
#TAG := $(shell if [ "$(BRANCH)" = "master" ];\
# then echo "$(IMAGE):$(VERSION)";\
# else echo "$(IMAGE):$(VERSION)-$(BRANCH)";\
# fi)
SHORT_HASH := `git rev-parse --short HEAD`
TAG := $(IMAGE):$(BRANCH)-$(VERSION)-$(SHORT_HASH)
deps-up:
docker-compose -f deps/docker-compose.yml up
deps-up-d:
docker-compose -f deps/docker-compose.yml up -d
deps-down:
docker-compose -f deps/docker-compose.yml down
clean:
@find . -type d -name "lcmap_blackmagic.egg-info" -exec rm -rf {} +
@find . -type f -name "*pyc" -exec rm -rf {} \;
@find . -type f -name "*~" -exec rm -rf {} \;
@find . -type d -name "__pycache__" -exec rm -rf {} +
set-nginx-cache-file-perms: deps-up-d
docker exec -it blackmagic-nginx /bin/bash -c "chmod -R 777 /data/nginx/cache"
clear-nginx-cache: deps-up-d
docker exec -it blackmagic-nginx /bin/bash -c "rm -rf /data/nginx/cache/*"
update-test-data: deps-up-d clear-nginx-cache tests set-nginx-cache-file-perms deps-down
@echo "NGINX cache files updated"
test-with-manual-deps:
pytest --ignore=deps/nginxcache -p no:warnings -vv
tests: deps-up-d test-with-manual-deps deps-down
docker-build:
@docker build --build-arg version=$(VERSION) -t $(BUILD_TAG) --rm=true --compress $(PWD)
docker-tag:
@docker tag $(BUILD_TAG) $(TAG)
docker-login:
@$(if $(and $(DOCKER_USER), $(DOCKER_PASS)), docker login -u $(DOCKER_USER) -p $(DOCKER_PASS), docker login)
docker-push: docker-login
docker push $(TAG)
all: tests clean docker-build docker-tag docker-push
debug:
@echo "VERSION: $(VERSION)"
@echo "IMAGE: $(IMAGE)"
@echo "BRANCH: $(BRANCH)"
@echo "BUILD_TAG: $(BUILD_TAG)"
@echo "TAG: $(TAG)"