-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
48 lines (37 loc) · 1.56 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
BUILD_CONTAINER_NAME ?= idm-docker-staging.packages.idmod.org/sfim-build-env:latest
.PHONY= get_version build-r-env build-r-package build-api help
help: ## This help.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
clean:
find . -iname *.tar.gz -exec rm {} \;
get_version:
$(eval version=$(git rev-parse --short HEAD))
build-r-env: ## build docker container that can package R scripts
docker build -f Dockerfile.RBuildEnv . \
-t $(BUILD_CONTAINER_NAME)
build-r-env-lite:
docker build --build-arg WORKERS=2 -f Dockerfile.RBuildEnv . \
-t $(BUILD_CONTAINER_NAME)
publish-r-env: build-r-env ## Publish our R Environment
docker push $(BUILD_CONTAINER_NAME)
pull-r-env: # Pull our R Build environment
ifndef SKIP_PULL
docker pull $(BUILD_CONTAINER_NAME)
else
@echo Skipping pull
endif
build-r-package: clean pull-r-env ## Build the r package as tar ball
# as we add more models we can just build them all here
# We have to run this with the build user's ids
# otherwise we end up with files we cannot modify
docker run -u $(shell id -u):$(shell id -g) \
-v $(PWD)/:/app \
-w /app $(BUILD_CONTAINER_NAME) \
bash -c "cd dbViewR && R CMD build . && \
cd ../incidenceMapR && R CMD build . && \
cd ../modelServR && R CMD build ."
build-production: build-r-package get_version ## Builds the api
-mkdir -p api_service/models
docker-compose -f docker-compose.production.yml build
publish-production: build-production ## Publishes the API
docker-compose -f docker-compose.production.yml push