Skip to content

Commit

Permalink
Prevent creating orphan containers with docker compose run
Browse files Browse the repository at this point in the history
  • Loading branch information
mtnstar committed Sep 23, 2024
1 parent b85c835 commit 4b99b0f
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion bin/hit/rails/bash
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

docker compose run \
--rm \
-e SKIP_INIT=1 \
rails \
bash
bash -l -c "/usr/local/bin/bundle exec bash"
3 changes: 2 additions & 1 deletion bin/hit/rails/console
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

docker compose run \
--rm \
-e SKIP_INIT=1 \
rails \
bundle exec rails c
bash -l -c "/usr/local/bin/bundle exec rails c"
3 changes: 2 additions & 1 deletion bin/hit/rails/routes
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

docker compose exec \
--rm \
-e SKIP_INIT=1 \
rails \
bundle exec rails routes
bash -l -c "/usr/local/bin/bundle exec rails routes"
1 change: 1 addition & 0 deletions bin/hit/rails/seed
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ docker compose run \
-e SKIP_INIT=1 \
rails \
bundle exec rails db:seed wagon:seed
bash -l -c "/usr/local/bin/bundle exec rails db:seed wagon:seed"
5 changes: 3 additions & 2 deletions bin/hit/test/env
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,13 @@ fi

# run test env
# Do not maintain schema for testing purposes
docker compose run --rm \
docker compose run \
--rm \
--workdir=$WORKDIR \
-e RAILS_ENV=test \
-e RAILS_TEST_DB_NAME=$TEST_DB_NAME \
-e RAILS_DB_NAME=$TEST_DB_NAME \
-e DISABLE_TEST_SCHEMA_MAINTENANCE=1 \
-e SKIP_INIT=1 \
rails_test \
bundle exec "$PREPARE_RAILS_SPEC_CMD && bash"
bash -l -c "/usr/local/bin/bundle exec '$PREPARE_RAILS_SPEC_CMD'; exec bash"
3 changes: 2 additions & 1 deletion bin/hit/test/prep
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env bash

# prepare bundle & co
docker compose run --rm \
docker compose run \
--rm \
--workdir=/usr/src/app/hitobito \
-e RAILS_ENV=development \
-e SKIP_INIT=1 \
Expand Down

0 comments on commit 4b99b0f

Please sign in to comment.