Makefile: added "x" to helpers to move them down in ABC sorting, added comments, "clean" clears everything now

This commit is contained in:
DarkCat09 2023-04-03 16:37:12 +04:00
parent f36dd51ba0
commit 1880c4100b

View file

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