2023-04-03 15:37:12 +03:00
|
|
|
# Default host and port values
|
2023-03-03 17:10:17 +03:00
|
|
|
APP_HOST ?= 0.0.0.0
|
|
|
|
APP_PORT ?= 8000
|
|
|
|
|
2023-04-03 15:37:12 +03:00
|
|
|
# Main commands
|
2023-02-18 19:01:13 +03:00
|
|
|
dev:
|
2023-03-24 19:10:05 +03:00
|
|
|
python3 -m dotenv -f version_code run \
|
2023-02-27 17:49:30 +03:00
|
|
|
python3 -m dotenv -f .env_debug run \
|
2023-04-03 15:37:12 +03:00
|
|
|
make xcmd-dev
|
2023-02-18 19:01:13 +03:00
|
|
|
|
|
|
|
prod:
|
2023-03-24 19:10:05 +03:00
|
|
|
python3 -m dotenv -f version_code run \
|
2023-03-03 17:10:17 +03:00
|
|
|
python3 -m gunicorn \
|
|
|
|
-w 4 -k uvicorn.workers.UvicornWorker \
|
|
|
|
-b $${APP_HOST}:$${APP_PORT} main:app
|
2023-02-18 19:01:13 +03:00
|
|
|
|
2023-04-03 15:37:12 +03:00
|
|
|
# Code checking
|
2023-02-18 19:01:13 +03:00
|
|
|
format:
|
|
|
|
python3 -m autopep8 -r --in-place app/
|
|
|
|
|
|
|
|
check:
|
|
|
|
python3 -m mypy app/
|
|
|
|
python3 -m pylint app/
|
|
|
|
|
2023-04-03 15:37:12 +03:00
|
|
|
# Docker
|
2023-02-18 19:01:13 +03:00
|
|
|
docker:
|
2023-03-01 15:05:20 +03:00
|
|
|
python3 -m dotenv -f version_code run \
|
2023-04-03 15:37:12 +03:00
|
|
|
make xcmd-docker-build
|
2023-03-03 13:23:46 +03:00
|
|
|
|
|
|
|
docker-build:
|
|
|
|
python3 -m dotenv -f version_code run \
|
2023-04-03 15:37:12 +03:00
|
|
|
make xcmd-docker-build
|
2023-02-18 19:01:13 +03:00
|
|
|
|
2023-03-01 18:39:12 +03:00
|
|
|
docker-push:
|
|
|
|
python3 -m dotenv -f version_code run \
|
2023-04-03 15:37:12 +03:00
|
|
|
make xcmd-docker-push
|
2023-03-01 18:39:12 +03:00
|
|
|
|
2023-04-03 15:37:12 +03:00
|
|
|
docker-run:
|
|
|
|
docker compose -f ./docker-compose.yml up -d
|
|
|
|
|
|
|
|
# Clear cache and binaries
|
2023-02-18 19:01:13 +03:00
|
|
|
clean:
|
2023-04-03 15:37:12 +03:00
|
|
|
rm -rf \
|
|
|
|
__pycache__ \
|
|
|
|
app/__pycache__ \
|
|
|
|
app/*/__pycache__ \
|
|
|
|
.mypy_cache \
|
|
|
|
app.egg-info \
|
|
|
|
dist
|
2023-03-03 13:23:46 +03:00
|
|
|
|
2023-04-03 15:37:12 +03:00
|
|
|
# Helpers, should not be used directly
|
|
|
|
xcmd-dev:
|
2023-03-03 17:10:17 +03:00
|
|
|
python3 -m uvicorn main:app \
|
|
|
|
--reload \
|
|
|
|
--host $${APP_HOST} \
|
|
|
|
--port $${APP_PORT}
|
|
|
|
|
2023-04-03 15:37:12 +03:00
|
|
|
xcmd-docker-build:
|
2023-03-03 16:16:40 +03:00
|
|
|
docker build \
|
2023-03-24 18:55:15 +03:00
|
|
|
-t ${REPO_OWNER_LOWER}/${REPO_NAME_KEBAB}:latest \
|
|
|
|
-t ${REPO_OWNER_LOWER}/${REPO_NAME_KEBAB}:$${VERSION} .
|
2023-03-03 13:23:46 +03:00
|
|
|
|
2023-04-03 15:37:12 +03:00
|
|
|
xcmd-docker-push:
|
2023-03-24 18:55:15 +03:00
|
|
|
docker push -a ${REPO_OWNER_LOWER}/${REPO_NAME_KEBAB}
|