|
|
#!/usr/bin/env bash |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set -euo pipefail |
|
|
|
|
|
|
|
|
echo "Please select an option:" |
|
|
echo "1) Run using Pre-built Image (Recommended)" |
|
|
echo "2) Build from Source and Run (For Developers)" |
|
|
read -r -p "Enter choice [1-2]: " choice |
|
|
|
|
|
|
|
|
case "$choice" in |
|
|
1) |
|
|
echo "--- Running with Pre-built Image ---" |
|
|
docker compose up -d --remove-orphans --no-build |
|
|
echo "Services are starting from remote image." |
|
|
echo "Run 'docker compose logs -f' to see the logs." |
|
|
;; |
|
|
2) |
|
|
echo "--- Building from Source and Running ---" |
|
|
|
|
|
|
|
|
VERSION="$(git describe --tags --always --dirty)" |
|
|
COMMIT="$(git rev-parse --short HEAD)" |
|
|
BUILD_DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)" |
|
|
|
|
|
echo "Building with the following info:" |
|
|
echo " Version: ${VERSION}" |
|
|
echo " Commit: ${COMMIT}" |
|
|
echo " Build Date: ${BUILD_DATE}" |
|
|
echo "----------------------------------------" |
|
|
|
|
|
|
|
|
export CLI_PROXY_IMAGE="cli-proxy-api:local" |
|
|
|
|
|
echo "Building the Docker image..." |
|
|
docker compose build \ |
|
|
--build-arg VERSION="${VERSION}" \ |
|
|
--build-arg COMMIT="${COMMIT}" \ |
|
|
--build-arg BUILD_DATE="${BUILD_DATE}" |
|
|
|
|
|
echo "Starting the services..." |
|
|
docker compose up -d --remove-orphans --pull never |
|
|
|
|
|
echo "Build complete. Services are starting." |
|
|
echo "Run 'docker compose logs -f' to see the logs." |
|
|
;; |
|
|
*) |
|
|
echo "Invalid choice. Please enter 1 or 2." |
|
|
exit 1 |
|
|
;; |
|
|
esac |