Skip to content

Commit

Permalink
Detect docker compose command
Browse files Browse the repository at this point in the history
depending on the version of docker.

Also removes the 'version' argument in docker-compose files, which is now deprecated.
  • Loading branch information
MonkeyDo committed May 14, 2024
1 parent 0f56759 commit a7d6734
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 12 deletions.
12 changes: 10 additions & 2 deletions develop-api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,13 @@ if [[ ! -d "src" ]]; then
exit -1
fi

docker-compose -f docker-compose.api.yml run --rm startup &&
docker-compose -f docker-compose.api.yml up --build bookbrainz-api
echo "Checking docker compose version"
if docker compose version &> /dev/null; then
DOCKER_COMPOSE_CMD="docker compose"
else
DOCKER_COMPOSE_CMD="docker-compose"
fi


$DOCKER_COMPOSE_CMD -f docker-compose.api.yml run --rm startup &&
$DOCKER_COMPOSE_CMD -f docker-compose.api.yml up --build bookbrainz-api
12 changes: 10 additions & 2 deletions develop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,13 @@ if [[ ! -d "src" ]]; then
exit -1
fi

docker-compose run --rm startup &&
docker-compose up --build bookbrainz-site
echo "Checking docker compose version"
if docker compose version &> /dev/null; then
DOCKER_COMPOSE_CMD="docker compose"
else
DOCKER_COMPOSE_CMD="docker-compose"
fi


$DOCKER_COMPOSE_CMD run --rm startup &&
$DOCKER_COMPOSE_CMD up --build bookbrainz-site
2 changes: 0 additions & 2 deletions docker-compose.api.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.4'

services:

bookbrainz-api:
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.4'

services:

bookbrainz-site:
Expand Down
11 changes: 9 additions & 2 deletions scripts/database-init-docker.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#!/usr/bin/env bash

docker-compose build &&
docker-compose run --rm bookbrainz-site scripts/wait-for-postgres.sh scripts/download-import-dump.sh
echo "Checking docker compose version"
if docker compose version &> /dev/null; then
DOCKER_COMPOSE_CMD="docker compose"
else
DOCKER_COMPOSE_CMD="docker-compose"
fi

$DOCKER_COMPOSE_CMD build &&
$DOCKER_COMPOSE_CMD run --rm bookbrainz-site scripts/wait-for-postgres.sh scripts/download-import-dump.sh
12 changes: 10 additions & 2 deletions stop.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
docker-compose down
docker-compose -f docker-compose.api.yml down
echo "Checking docker compose version"
if docker compose version &> /dev/null; then
DOCKER_COMPOSE_CMD="docker compose"
else
DOCKER_COMPOSE_CMD="docker-compose"
fi


$DOCKER_COMPOSE_CMD down
$DOCKER_COMPOSE_CMD -f docker-compose.api.yml down

0 comments on commit a7d6734

Please sign in to comment.