fix: isolate backend compose project
This commit is contained in:
1 parent
ac0d3856f0
commit
78d06d0ba0
3 files changed
+43
-5
No files matched your search
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
env_file="${1:-compose/.env}"
|
||||
compose_file="${BACKEND_COMPOSE_FILE:-compose/docker-compose.backend.yml}"
|
||||
|
||||
if [[ ! -r "$env_file" ]]; then
|
||||
printf 'Environment file not found: %s\n' "$env_file" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
env_value() {
|
||||
sed -n "s/^${1}=//p" "$env_file" | head -n 1
|
||||
}
|
||||
|
||||
project_name="$(env_value BACKEND_COMPOSE_PROJECT_NAME)"
|
||||
if [[ -z "$project_name" || "$project_name" == "$(env_value COMPOSE_PROJECT_NAME)" ]]; then
|
||||
printf 'BACKEND_COMPOSE_PROJECT_NAME must be set and differ from the infrastructure project.\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
compose_command=(
|
||||
docker compose
|
||||
--project-name "$project_name"
|
||||
--env-file "$env_file"
|
||||
-f "$compose_file"
|
||||
)
|
||||
"${compose_command[@]}" config --quiet
|
||||
"${compose_command[@]}" up -d
|
||||
"${compose_command[@]}" ps --all
|
||||
Reference in new issue
Block a user