diff --git a/Makefile b/Makefile index dcf82fa..66e2dce 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,12 @@ +# Default host and port values APP_HOST ?= 0.0.0.0 APP_PORT ?= 8000 +# Main commands dev: python3 -m dotenv -f version_code run \ python3 -m dotenv -f .env_debug run \ - make cmd-dev + make xcmd-dev prod: python3 -m dotenv -f version_code run \ @@ -12,6 +14,7 @@ prod: -w 4 -k uvicorn.workers.UvicornWorker \ -b $${APP_HOST}:$${APP_PORT} main:app +# Code checking format: python3 -m autopep8 -r --in-place app/ @@ -19,34 +22,43 @@ check: python3 -m mypy app/ python3 -m pylint app/ +# Docker docker: python3 -m dotenv -f version_code run \ - make cmd-docker-build + make xcmd-docker-build docker-build: python3 -m dotenv -f version_code run \ - make cmd-docker-build + make xcmd-docker-build docker-push: python3 -m dotenv -f version_code run \ - make cmd-docker-push + make xcmd-docker-push +docker-run: + docker compose -f ./docker-compose.yml up -d + +# Clear cache and binaries clean: - rm -rf app/__pycache__ - rm -rf app/*/__pycache__ - rm -rf __pycache__ - rm -rf .mypy_cache + rm -rf \ + __pycache__ \ + app/__pycache__ \ + app/*/__pycache__ \ + .mypy_cache \ + app.egg-info \ + dist -cmd-dev: +# Helpers, should not be used directly +xcmd-dev: python3 -m uvicorn main:app \ --reload \ --host $${APP_HOST} \ --port $${APP_PORT} -cmd-docker-build: +xcmd-docker-build: docker build \ -t ${REPO_OWNER_LOWER}/${REPO_NAME_KEBAB}:latest \ -t ${REPO_OWNER_LOWER}/${REPO_NAME_KEBAB}:$${VERSION} . -cmd-docker-push: +xcmd-docker-push: docker push -a ${REPO_OWNER_LOWER}/${REPO_NAME_KEBAB}