Files
docker-stacks/examples/make-deploy/Makefile
Yuvi Panda bceaead5d2 Migrate start-notebook & start-singleuser to python (#2006)
* Migrate start-notebook.sh to bash

Based on

> Stop using bash, haha 👍

from https://github.com/jupyter/docker-stacks/issues/1532.

If there's more apetite for this, I'll try to migrate
`start.sh` and `start-singleuser.sh` as well - I think they should
all be merged together. We can remove the `.sh` suffixes for
accuracy, and keep symlinks in so old config still works. Since
the shebang is what is used to launch the correct interpreter,
the `.sh` doesn't matter.

Will help fix https://github.com/jupyter/docker-stacks/issues/1532,
as I believe all those things are going to be easier to do from
python than bash

* Rename start-notebook.sh to start-notebook

* Cleanup start-notebook a little

* Fix typo

* Migrate start-singleuser as well

* Remove unused import

* Run symlink commands as root

* Combine repetitive RUN commands

* Remove multiple args to env

-u can not be set by shebang, we must set the env var
instead

* Fix conditional inversion

Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>

* Fix how start-singleuser is exec'd

* Actually call jupyterhub-singleuser in start-singleuser

* Pass through any additional args we get

* Put .py suffix on the start-* scripts

* Add .sh shims for the start-* scripts

* Document start-notebook.sh and start-singleuser.sh

* Partially test start-notebook.sh

* Reflow warning docs

Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>

---------

Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
2023-10-17 14:46:43 +02:00

45 lines
1.3 KiB
Makefile

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
.PHONY: help check image notebook
IMAGE:=my-notebook
# Common, extensible docker run command
define RUN_NOTEBOOK
@docker volume create --name $(WORK_VOLUME) > /dev/null
-@docker rm --force $(NAME) 2> /dev/null
@docker run --detach -p $(PORT):8888 \
--name $(NAME) \
-v $(WORK_VOLUME):/home/jovyan/work \
$(DOCKER_ARGS) \
$(IMAGE) bash -c "$(PRE_CMD) chown jovyan /home/jovyan/work && start-notebook.py $(ARGS)" > /dev/null
@echo "DONE: Notebook '$(NAME)' listening on $$(docker-machine ip $$(docker-machine active)):$(PORT)"
endef
help:
@cat README.md
check:
@which docker-machine > /dev/null || (echo "ERROR: docker-machine not found (brew install docker-machine)"; exit 1)
@which docker > /dev/null || (echo "ERROR: docker not found (brew install docker)"; exit 1)
@docker | grep volume > /dev/null || (echo "ERROR: docker 1.9.0+ required"; exit 1)
image: DOCKER_ARGS?=
image:
@docker build --rm $(DOCKER_ARGS) --tag $(IMAGE) .
notebook: PORT?=80
notebook: NAME?=notebook
notebook: WORK_VOLUME?=$(NAME)-data
notebook: check
$(RUN_NOTEBOOK)
# docker-machine drivers
include virtualbox.makefile
include softlayer.makefile
# Preset notebook configurations
include self-signed.makefile
include letsencrypt.makefile