From 924e421ec986991aa54dea441156abcee17ee696 Mon Sep 17 00:00:00 2001 From: earthcomfy Date: Fri, 3 Jan 2025 14:53:39 +0300 Subject: [PATCH] Add justfile for use with docker --- hooks/post_gen_project.py | 1 + {{cookiecutter.project_slug}}/justfile | 33 ++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 {{cookiecutter.project_slug}}/justfile diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index ca1ffad32..1eee7ef6d 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -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) diff --git a/{{cookiecutter.project_slug}}/justfile b/{{cookiecutter.project_slug}}/justfile new file mode 100644 index 000000000..a20df231c --- /dev/null +++ b/{{cookiecutter.project_slug}}/justfile @@ -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}}" }}