-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
51 lines (39 loc) · 1.33 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
#!/usr/bin/env make
# set variables if env variables aren't set
ifndef BUILD_VERSION
BUILD_VERSION := "latest"
endif
ifndef DOCKER_IMAGE_NAME
DOCKER_IMAGE_NAME := "black-oak"
endif
ifndef DOCKER_CACHE_IMAGE
DOCKER_CACHE_IMAGE := $(DOCKER_IMAGE_NAME)-$(BUILD_VERSION).tar
endif
MAKEFLAGS += --silent
docker-build:
docker build -t $(DOCKER_IMAGE_NAME):$(BUILD_VERSION) .
# saves docker image to disk
docker-save:
docker save $(DOCKER_IMAGE_NAME):$(BUILD_VERSION) > $(DOCKER_CACHE_IMAGE)
# load saved image
docker-load:
docker load < $(DOCKER_CACHE_IMAGE)
# runs the container
docker-run: docker-build
docker run --rm -it $(DOCKER_IMAGE_NAME):$(BUILD_VERSION) ./bin/run_ohlcv_data_fetcher.sh config.toml
# runs container with mounted ./data directory
docker-run-with-mountpoint: docker-build
docker run -it -v $(PWD)/data/:/usr/src/app/data/ $(DOCKER_IMAGE_NAME):$(BUILD_VERSION) ./bin/run_ohlcv_data_fetcher.sh config.toml
# unit tests with docker cache
docker-test-from-cache: docker-load
docker run --rm $(DOCKER_IMAGE_NAME):$(BUILD_VERSION) python -m pytest
# unit tests
docker-test: docker-build
docker run --rm $(DOCKER_IMAGE_NAME):$(BUILD_VERSION) python -m pytest
.PHONY: docker-build
.PHONY: docker-save
.PHONY: docker-load
.PHONY: docker-run
.PHONY: docker-run-with-mountpoint
.PHONY: docker-test-from-cache
.PHONY: docker-test