File size: 1,493 Bytes
8744085
 
 
 
 
a5f6c09
8744085
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
04c2b04
8744085
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
.PHONY: help build dev integration-test push
.DEFAULT_GOAL := help

# Docker image build info
PROJECT:=wordify
BUILD_TAG?=v0.1.0-alpha

ALL_IMAGES:=src

help:
# http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
	@echo "python starter project"
	@echo "====================="
	@echo "Replace % with a directory name (e.g., make build/python-example)"
	@echo
	@grep -E '^[a-zA-Z0-9_%/-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

########################################################
## Local development
########################################################

dev: ARGS?=/bin/bash
dev: DARGS?=-v "${CURDIR}":/var/dev
dev: ## run a foreground container
	docker run -it --rm -p 8501:8501 $(DARGS) $(PROJECT):${BUILD_TAG} $(ARGS)


notebook: ARGS?=jupyter lab
notebook: DARGS?=-v "${CURDIR}":/var/dev -p 8888:8888 ##notebook shall be run on http://0.0.0.0:8888 by default. Change to a different port (e.g. 8899) if 8888 is used for example 8899:8888
notebook: ## run a foreground container
	docker run -it --rm $(DARGS) $(PROJECT) $(ARGS) \
		--ip=0.0.0.0 \
		--allow-root \
		--NotebookApp.token="" \
		--NotebookApp.password=""

build: DARGS?=
build: ## build the latest image for a project
	docker build $(DARGS) --build-arg BUILD_TAG=${BUILD_TAG} --rm --force-rm -t $(PROJECT):${BUILD_TAG} .

run:
	docker run -d --name $(PROJECT)-${BUILD_TAG}-container -it --rm -p 8501:8501 $(PROJECT):${BUILD_TAG}