-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
44 lines (35 loc) · 1.36 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
.PHONY : build clean-u clean-all run shell jup stop
CONTAINER_TAG=example_name
help: ## Commands to run
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
build: ## Build the Docker Container
echo
echo "Build the Docker Container and tag it: $(CONTAINER_TAG)"
docker build --tag $(CONTAINER_TAG) .
clean-u: ## Clean unused docker containers
echo
echo "Deleting all unused Docker containers."
docker system prune --all --force --volumes
clean-all: ## Clean *all* docker containers
echo
echo "Deleting *ALL* Docker containers!"
docker container stop $(docker container ls --all --quiet) && docker system prune --all --force --volumes
run: ## Run the main.py file
docker run $(CONTAINER_TAG) python3 src/main.py
shell: ## Launch the container shell (for dev)
echo
echo "Opening shell in $(CONTAINER_TAG)"
echo "To leave the shell run: 'exit'"
docker run --interactive --tty --volume "$(pwd)":/container_root\
$(CONTAINER_TAG) /bin/sh
jup: ## Launch Jupyter Notebooks
echo
echo "Starting the Jupyter server."
echo "Control c to stop"
docker run --publish 8888:8888 --volume "$(pwd)":/container_root \
--detach $(CONTAINER_TAG) jupyter
echo "Go to http://localhost:8888/."
stop: ## Stop all containers
echo
echo "Stopping all containers"
-docker stop -t0 $(shell docker ps -a -q) 2> /dev/null