|
| 1 | +# Copyright (c) 2021 Wikimedia Foundation and contributors. |
| 2 | +# All Rights Reserved. |
| 3 | +# |
| 4 | +# This file is part of Wikimedia Developer Portal. |
| 5 | +# |
| 6 | +# Wikimedia Developer Portal is free software: you can redistribute it and/or |
| 7 | +# modify it under the terms of the GNU General Public License as published by |
| 8 | +# the Free Software Foundation, either version 3 of the License, or (at your |
| 9 | +# option) any later version. |
| 10 | +# |
| 11 | +# Wikimedia Developer Portal is distributed in the hope that it will be |
| 12 | +# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| 14 | +# Public License for more details. |
| 15 | +# |
| 16 | +# You should have received a copy of the GNU General Public License along with |
| 17 | +# Wikimedia Developer Portal. If not, see <http://www.gnu.org/licenses/>. |
| 18 | + |
| 19 | +this := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) |
| 20 | +PROJECT_DIR := $(dir $(this)) |
| 21 | +PIPELINE_DIR := $(PROJECT_DIR)/.pipeline |
| 22 | +BLUBBEROID := https://blubberoid.wikimedia.org |
| 23 | +DOCKERFILES := $(PIPELINE_DIR)/dev-python.Dockerfile |
| 24 | + |
| 25 | +help: |
| 26 | + @echo "Make targets:" |
| 27 | + @echo "=============" |
| 28 | + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \ |
| 29 | + awk 'BEGIN {FS = ":.*?## "}; {printf "%-20s %s\n", $$1, $$2}' |
| 30 | +.PHONY: help |
| 31 | + |
| 32 | +start: $(DOCKERFILES) ## Start the docker-compose stack |
| 33 | + docker compose up --build --detach |
| 34 | +.PHONY: start |
| 35 | + |
| 36 | +stop: ## Stop the docker-compose stack |
| 37 | + docker compose stop |
| 38 | +.PHONY: stop |
| 39 | + |
| 40 | +restart: stop start ## Restart the docker-compose stack |
| 41 | +.PHONY: restart |
| 42 | + |
| 43 | +status: ## Show status of the docker-compose stack |
| 44 | + docker compose ps |
| 45 | +.PHONY: status |
| 46 | + |
| 47 | +shell: ## Get an interactive shell inside the container |
| 48 | + docker compose exec portal bash |
| 49 | +.PHONY: shell |
| 50 | + |
| 51 | +tail: ## Tail logs from the docker-compose stack |
| 52 | + docker compose logs -f |
| 53 | +.PHONY: tail |
| 54 | + |
| 55 | +clean: ## Clean up Docker images and containers |
| 56 | + yes | docker image prune |
| 57 | + yes | docker container prune |
| 58 | +.PHONY: clean |
| 59 | + |
| 60 | +%.Dockerfile: $(PIPELINE_DIR)/blubber.yaml |
| 61 | + echo "# Dockerfile for *local development*." > $@ |
| 62 | + echo "# Generated by Blubber from .pipeline/blubber.yaml" >> $@ |
| 63 | + curl -sH 'content-type: application/yaml' --data-binary @$^ \ |
| 64 | + $(BLUBBEROID)/v1/$(*F) >> $@ |
0 commit comments