65 lines
1.4 KiB
Makefile
65 lines
1.4 KiB
Makefile
ROOT_DIR = $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
|
|
PYTHON = $(ROOT_DIR)venv/bin/python
|
|
REGISTRY :=
|
|
|
|
GIT_BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
|
|
GIT_SHA = $(shell git rev-parse --short HEAD)
|
|
VERSION := 0.1.0
|
|
|
|
format:
|
|
@$(PYTHON) -m black mumui/*.py deployment/*.py
|
|
|
|
lint:
|
|
@$(PYTHON) -m ruff .
|
|
|
|
dev:
|
|
rm -rf venv
|
|
python3 -m virtualenv venv
|
|
$(PYTHON) -m pip install -r requirements.txt
|
|
$(PYTHON) -m pip install -r requirements-dev.txt
|
|
|
|
django:
|
|
docker build . -t mumui:local
|
|
|
|
pushpin-local:
|
|
cd pushpin && docker build . -t pushpin:mumui
|
|
|
|
nginx-local:
|
|
cd nginx && docker build . -t nginx:mumui
|
|
|
|
build:
|
|
$(MAKE) pushpin-local
|
|
$(MAKE) nginx-local
|
|
$(MAKE) django
|
|
|
|
.PHONY: static
|
|
static:
|
|
SECRET_KEY="" $(PYTHON) manage.py collectstatic --no-input
|
|
|
|
run: pushpin-local nginx-local django
|
|
@docker compose up
|
|
|
|
show:
|
|
@echo "branch: $(GIT_BRANCH)"
|
|
@echo "version: $(VERSION)"
|
|
@echo "registry: $(REGISTRY)"
|
|
|
|
deploy: pushpin-local django static
|
|
@cp -pr static .deploy/prod/
|
|
@cp -pr static .deploy/stage/
|
|
|
|
@docker tag pushpin:mumui $(REGISTRY)/pushpin:mumui
|
|
@docker push $(REGISTRY)/pushpin:mumui
|
|
|
|
@docker tag mumui:local $(REGISTRY)/mumui:$(VERSION)
|
|
@docker push $(REGISTRY)/mumui:$(VERSION)
|
|
|
|
@ngxsd mumui --env prod --var port=8090 --var version=$(VERSION)
|
|
@ngxsd mumui --env stage --var port=8090 --nginx
|
|
|
|
destroy:
|
|
@ngxsd mumui --env prod --destroy
|
|
@ngxsd mumui --env stage --destroy --nginx
|
|
|
|
|