Add a docker rails console script
This commit is contained in:
20
bin/docker-rails-console
Normal file
20
bin/docker-rails-console
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/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
|
||||
# ---
|
||||
# filename: docker-rails-console
|
||||
# version: 1.0
|
||||
# content_checksum: sha256:c3a98dedbafbc310008382042630a5a4152fb12f02b497c57c7198fc6bca8fbc
|
||||
# @PICOPACKAGE_END
|
||||
Reference in New Issue
Block a user