Skip to content

Commit

Permalink
deploy: Update Makefile to dynamically select Docker Compose command …
Browse files Browse the repository at this point in the history
…based on Docker version.

The deployment Makefile has been updated to dynamically determine whether to use 'docker compose'
or 'docker-compose' based on the installed Docker version. This change ensures compatibility
across different Docker versions, automatically adjusting the command to match the Docker CLI's
evolution.
  • Loading branch information
OhmSpectator committed Mar 14, 2024
1 parent 30fdd7c commit 31c3c2e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions deployment/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ PROJECT_NAME = tyr
# Default environment file
ENV_FILE = .env.development

# Docker Compose command with default environment file
DC = docker-compose --env-file $(ENV_FILE)
# Determine the Docker Compose command based on the Docker version
export DC := $(shell command -v docker >/dev/null && docker --version | awk '{print $$3}' | cut -d'.' -f1,2 | sed 's/,//g' | (read v; if [ $$(echo "$$v >= 20.10" | bc -l) -eq 1 ]; then echo "docker compose --env-file $(ENV_FILE)"; else echo "docker-compose --env-file $(ENV_FILE)"; command -v docker-compose >/dev/null || { echo "Error: Docker Compose is not installed." >&2; exit 1; }; fi))

# Required environment variables
REQUIRED_ENV_VARS = DB_NAME DB_USER DB_PASSWORD GADM_FILE POSTGIS_VERSION
Expand Down

0 comments on commit 31c3c2e

Please sign in to comment.