Skip to content

Commit

Permalink
all: Create compose build script
Browse files Browse the repository at this point in the history
To make sure git commit hash properly passed
  • Loading branch information
somnisomni committed Oct 30, 2023
1 parent 029d75e commit 0763487
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
26 changes: 26 additions & 0 deletions compose-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh

GIT_COMMIT_HASH=$(git rev-parse --short HEAD)
COMPOSE=docker-compose
COMPOSE_FILE=compose.local.yaml

if ! command -v $COMPOSE > /dev/null 2>&1; then
if command -v podman-compose > /dev/null 2>&1; then
COMPOSE=podman-compose
else
echo "Error: Neither docker-compose nor podman-compose found."
exit 1
fi
fi

if ! [ -f "$COMPOSE_FILE" ]; then
if [ -f "compose.yaml" ]; then
COMPOSE_FILE=compose.yaml
else
echo "Error: Neither compose.local.yaml nor compose.yaml found."
exit 1
fi
fi

$COMPOSE -f $COMPOSE_FILE down
$COMPOSE -f $COMPOSE_FILE up -d --build
2 changes: 1 addition & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
context: .
dockerfile: ./projects/Admin/Containerfile
args:
GIT_HASH: $(git rev-parse --short HEAD)
GIT_HASH: ${GIT_COMMIT_HASH}
API_SERVER_URL: "http://localhost:31111"
BASE_PATH: "/admin"
ports:
Expand Down

0 comments on commit 0763487

Please sign in to comment.