switch between arti and default
This commit is contained in:
@@ -26,6 +26,9 @@ fi
|
||||
|
||||
# Parse command line arguments
|
||||
REBUILD=false
|
||||
USE_ARTIFACTORY=false
|
||||
NPM_REGISTRY="public"
|
||||
BUILD_ARGS=""
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
@@ -33,13 +36,23 @@ while [[ $# -gt 0 ]]; do
|
||||
REBUILD=true
|
||||
shift
|
||||
;;
|
||||
-bsf)
|
||||
USE_ARTIFACTORY=true
|
||||
NPM_REGISTRY="artifactory"
|
||||
BUILD_ARGS="--build-arg NPM_REGISTRY=artifactory"
|
||||
shift
|
||||
;;
|
||||
--help)
|
||||
echo "Usage: $0 [OPTIONS]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --rebuild Force rebuild of all containers"
|
||||
echo " -bsf Use Artifactory npm registry instead of public npm"
|
||||
echo " --help Show this help message"
|
||||
echo ""
|
||||
echo "Environment Variables (when using -bsf):"
|
||||
echo " ARTIFACTORY_AUTH_TOKEN Authentication token for Artifactory"
|
||||
echo ""
|
||||
echo "Brings up the complete stack: database, backend API, and frontend"
|
||||
echo ""
|
||||
exit 0
|
||||
@@ -52,6 +65,20 @@ while [[ $# -gt 0 ]]; do
|
||||
esac
|
||||
done
|
||||
|
||||
# If using Artifactory, add auth token to build args if available
|
||||
if [ "$USE_ARTIFACTORY" = true ]; then
|
||||
echo "Using Artifactory npm registry"
|
||||
if [ -n "$ARTIFACTORY_AUTH_TOKEN" ]; then
|
||||
echo "✓ Artifactory auth token detected"
|
||||
BUILD_ARGS="$BUILD_ARGS --build-arg ARTIFACTORY_AUTH_TOKEN=$ARTIFACTORY_AUTH_TOKEN"
|
||||
else
|
||||
echo "⚠ Warning: ARTIFACTORY_AUTH_TOKEN not set (may be required for authentication)"
|
||||
fi
|
||||
else
|
||||
echo "Using public npm registry (registry.npmjs.org)"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Create .env file if it doesn't exist
|
||||
if [ ! -f .env ]; then
|
||||
echo "Creating .env file from .env.example..."
|
||||
@@ -71,10 +98,20 @@ if [ "$REBUILD" = true ]; then
|
||||
echo "Removing existing images for rebuild..."
|
||||
$COMPOSE_CMD down --rmi local 2>/dev/null || true
|
||||
echo "Building and starting all services..."
|
||||
$COMPOSE_CMD up -d --build
|
||||
if [ -n "$BUILD_ARGS" ]; then
|
||||
$COMPOSE_CMD build $BUILD_ARGS
|
||||
$COMPOSE_CMD up -d
|
||||
else
|
||||
$COMPOSE_CMD up -d --build
|
||||
fi
|
||||
else
|
||||
echo "Starting all services..."
|
||||
$COMPOSE_CMD up -d
|
||||
if [ -n "$BUILD_ARGS" ]; then
|
||||
$COMPOSE_CMD build $BUILD_ARGS
|
||||
$COMPOSE_CMD up -d
|
||||
else
|
||||
$COMPOSE_CMD up -d
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
Reference in New Issue
Block a user