|
| 1 | +.PHONY: build build-no-cache up up-d down restart logs shell validate ayce default help |
| 2 | + |
| 3 | +COMPOSE = docker compose |
| 4 | +IMAGE = quay.io/jupyter/all-spark-notebook:2026-03-23 |
| 5 | + |
| 6 | +# Default target |
| 7 | +default: help |
| 8 | + |
| 9 | +# Display help information |
| 10 | +help: |
| 11 | + @echo "Available targets:" |
| 12 | + @echo " make (default) - Display this help message" |
| 13 | + @echo " make build - Build the Docker image" |
| 14 | + @echo " make build-no-cache - Build the Docker image without cache" |
| 15 | + @echo " make up - Start JupyterLab in the foreground" |
| 16 | + @echo " make up-d - Start JupyterLab in the background" |
| 17 | + @echo " make down - Stop and remove containers" |
| 18 | + @echo " make restart - Restart running containers" |
| 19 | + @echo " make logs - Tail container logs" |
| 20 | + @echo " make shell - Open a shell in the running container" |
| 21 | + @echo " make validate - Build image and verify PySpark imports correctly" |
| 22 | + @echo " make ayce - Run build and validate" |
| 23 | + @echo "" |
| 24 | + |
| 25 | +# Build the Docker image |
| 26 | +build: |
| 27 | + $(COMPOSE) build |
| 28 | + |
| 29 | +# Build without layer cache (useful after Dockerfile changes) |
| 30 | +build-no-cache: |
| 31 | + $(COMPOSE) build --no-cache |
| 32 | + |
| 33 | +# Start JupyterLab in the foreground |
| 34 | +up: |
| 35 | + $(COMPOSE) up |
| 36 | + |
| 37 | +# Start JupyterLab in the background |
| 38 | +up-d: |
| 39 | + $(COMPOSE) up -d |
| 40 | + |
| 41 | +# Stop and remove containers |
| 42 | +down: |
| 43 | + $(COMPOSE) down |
| 44 | + |
| 45 | +# Restart running containers |
| 46 | +restart: |
| 47 | + $(COMPOSE) restart |
| 48 | + |
| 49 | +# Tail container logs |
| 50 | +logs: |
| 51 | + $(COMPOSE) logs -f |
| 52 | + |
| 53 | +# Open a bash shell in the running JupyterLab container |
| 54 | +shell: |
| 55 | + $(COMPOSE) exec jupyterlab /bin/bash |
| 56 | + |
| 57 | +# Verify PySpark is importable inside the image |
| 58 | +validate: |
| 59 | + @echo "Validating PySpark installation..." |
| 60 | + @docker run --rm $(IMAGE) python -c "import pyspark; print('PySpark', pyspark.__version__, 'OK')" \ |
| 61 | + && echo "Validation passed." \ |
| 62 | + || (echo "Validation FAILED." && exit 1) |
| 63 | + |
| 64 | +# All You Can Eat - build and validate |
| 65 | +ayce: build validate |
0 commit comments