Initial commit
This commit is contained in:
48
Makefile
Normal file
48
Makefile
Normal file
@@ -0,0 +1,48 @@
|
||||
.PHONY: help clean build start stop bootstrap enter clone
|
||||
|
||||
REPO := https://github.com/jupyterhub/the-littlest-jupyterhub
|
||||
PORT := -p 127.0.0.3:8080:80
|
||||
SOCK := -v /var/run/docker.sock:/var/run/docker.sock
|
||||
CLIENT := -v /usr/bin/docker:/usr/bin/docker
|
||||
SRCDIR := -v "$(CURDIR)/tljh:/srv/src"
|
||||
NAME := tljh-dev
|
||||
TAG := tljh:dev
|
||||
EXISTS := $(shell docker inspect $(TAG) >/dev/null 2>&1 && echo YES || echo NO)
|
||||
CONTID := $(shell docker ps -q -f 'NAME=$(NAME)' 2>/dev/null || true)
|
||||
|
||||
help: ## Display this help message
|
||||
ifeq ($(EXISTS),YES)
|
||||
@echo "Docker image:"
|
||||
@docker images $(TAG)
|
||||
endif
|
||||
ifneq ($(CONTID),)
|
||||
@echo "Container:"
|
||||
@docker ps -s -f 'ID=$(CONTID)'
|
||||
endif
|
||||
@echo ""
|
||||
@echo "Usage:"
|
||||
@sed -nE 's!^([^:]+):\s*##\s*(.+)\s*$$!\tmake \1\t- \2!p' Makefile
|
||||
|
||||
clean: ## Remove the docker image and container
|
||||
-docker rm -f $(NAME)
|
||||
-docker rmi $(TAG)
|
||||
|
||||
build: ## Build the 'hub' docker image
|
||||
docker build --rm -t $(TAG) .
|
||||
|
||||
start: ## Start the JupyterHub container
|
||||
docker run --privileged --rm -d --name=$(NAME) $(PORT) $(SOCK) $(CLIENT) $(SRCDIR) $(TAG)
|
||||
|
||||
stop: ## Stop and remove the container
|
||||
docker rm -f $(NAME)
|
||||
|
||||
bootstrap: ## Run the bootstrap script in the container
|
||||
docker exec -ti -w /srv/src/bootstrap $(NAME) python3 ./bootstrap.py --admin dad:DadStuff
|
||||
|
||||
enter: ## Open a shell in the container
|
||||
docker exec -ti $(NAME) /bin/bash
|
||||
|
||||
clone: ## Clone the repository
|
||||
git clone --depth=1 $(REPO) tljh
|
||||
|
||||
# vim:ai noet ts=8 sw=8 wm=0:
|
||||
Reference in New Issue
Block a user