Add justfile for use with docker

This commit is contained in:
earthcomfy 2025-01-03 14:53:39 +03:00
parent 3ef84f1a26
commit 924e421ec9
2 changed files with 34 additions and 0 deletions

View File

@ -82,6 +82,7 @@ def remove_docker_files():
"docker-compose.local.yml",
"docker-compose.production.yml",
".dockerignore",
"justfile",
]
for file_name in file_names:
os.remove(file_name)

View File

@ -0,0 +1,33 @@
export COMPOSE_FILE := "docker-compose.local.yml"
# Default command to list all available commands.
default:
@just --list
# build: Build python image.
build:
@echo "Building python image..."
@docker-compose build
# up: Start up containers.
up:
@echo "Starting up containers..."
@docker-compose up -d --remove-orphans
# down: Stop containers.
down:
@echo "Stopping containers..."
@docker-compose down
# prune: Remove containers and their volumes.
prune *args:
@echo "Killing containers and removing volumes..."
@docker-compose down -v {{ "{{args}}" }}
# logs: View container logs
logs *args:
@docker-compose logs -f {{ "{{args}}" }}
# manage: Executes `manage.py` command.
manage +args:
@docker-compose run --rm django python ./manage.py {{ "{{args}}" }}