summaryrefslogtreecommitdiffstats
path: root/acid
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2023-09-09 11:50:15 -0400
committerMalfurious <m@lfurio.us>2023-09-10 04:47:40 -0400
commit8102d3dfa6914730e4d2aae26cd33c53c276da11 (patch)
treed01cd9fd1233c52b642a412b1e13720e2ca18276 /acid
parentd07f07847cb8086ffafac412a1ad14d8a953f9da (diff)
downloadcychedelic-8102d3dfa6914730e4d2aae26cd33c53c276da11.tar.gz
cychedelic-8102d3dfa6914730e4d2aae26cd33c53c276da11.zip
acid: build: Always specify --project-name
The script is refactored to always provide an explicit --project-name option to docker compose. Still taken from the $CYCHE_SERVICES config and only modified if --self is given. This addresses an issue when using a docker-compose.yml from within a subdirectory. If --project-name is omitted, the directory name used by docker is the one containing the YML file, not the working directory (git repository root). When calling `docker compose down` (when given --self), we now omit the --file as it is unnecessary. Signed-off-by: Malfurious <m@lfurio.us>
Diffstat (limited to 'acid')
-rwxr-xr-xacid/cyche-build20
1 files changed, 10 insertions, 10 deletions
diff --git a/acid/cyche-build b/acid/cyche-build
index 310a087..7f63117 100755
--- a/acid/cyche-build
+++ b/acid/cyche-build
@@ -27,18 +27,18 @@ cd "/services/$1"
if [ "$4" == "--self" ]; then
prev=$(cat '.git/previous_slug')
- [ -n "$prev" ] && prev="--project-name $prev"
-
- slug=$(echo -n "$1-"; tr -dc a-z </dev/urandom | head -c 12)
- next="--project-name $slug"
+ [ -z "$prev" ] && prev="$1"
+ name=$(echo -n "$1-"; tr -dc a-z </dev/urandom | head -c 12)
+else
+ name="$1"
fi
-docker compose $next --file "$2" pull
-docker compose $next --file "$2" build \
+docker compose --project-name "$name" --file "$2" pull
+docker compose --project-name "$name" --file "$2" build \
--force-rm \
--no-cache \
--pull
-docker compose $next --file "$2" up \
+docker compose --project-name "$name" --file "$2" up \
--detach \
--remove-orphans \
--force-recreate
@@ -46,7 +46,7 @@ docker compose $next --file "$2" up \
echo "$3" >.git/previous_hash
if [ "$4" == "--self" ]; then
- echo "$slug" >.git/previous_slug
- docker compose --file "$2" down
- docker compose $prev --file "$2" down
+ echo "$name" >.git/previous_slug
+ docker compose --project-name "$1" down
+ docker compose --project-name "$prev" down
fi