Files
tools/bin/docker-rails-console
2025-01-31 12:39:32 +11:00

22 lines
730 B
Bash

#!/bin/bash
# Get the container name from first argument, default to 'web' if not provided
container_name=${1:-web}
# Check if we're in a directory with either compose.yml or compose.yaml
if [[ ! -f "compose.yml" ]] && [[ ! -f "compose.yaml" ]]; then
echo "No compose.yml or compose.yaml found in current directory"
exit 1
fi
# Connect to the rails console with specified container
docker compose exec -it "$container_name" bundle exec rails console
# @PICOPACKAGE_START
# ---
# url: https://git.booko.info/dkam/tools/raw/branch/main/bin/docker-rails-console
# filename: docker-rails-console
# version: 1.0
# content_checksum: sha256:c3a98dedbafbc310008382042630a5a4152fb12f02b497c57c7198fc6bca8fbc
# @PICOPACKAGE_END