app := "nexus-nexus-app-1"
composer := "php /usr/bin/composer"

# Docker
up:
    docker compose up -d

down:
    docker compose down

build:
    docker compose build

rebuild:
    docker compose down
    docker compose build --no-cache
    docker compose up -d

logs:
    docker compose logs -f

shell:
    docker exec -it {{app}} bash

# Laravel
artisan *args:
    docker exec -it {{app}} php artisan {{args}}

composer *args:
    docker exec -it {{app}} {{composer}} {{args}}

migrate:
    docker exec -it {{app}} php artisan migrate

migrate-fresh:
    docker exec -it {{app}} php artisan migrate:fresh --seed

tinker:
    docker exec -it {{app}} php artisan tinker

test:
    docker exec -it {{app}} php artisan test

# Setup
setup:
    docker exec {{app}} {{composer}} install
    docker exec {{app}} sh -c "[ -f .env ] || cp .env.example .env"
    docker exec -it {{app}} php artisan key:generate
    docker exec -it {{app}} php artisan migrate --force
    docker exec nexus-frontend npm install
    docker exec nexus-frontend npm run build
