|
|
@ -13,6 +13,19 @@ echo "==========================================" |
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
|
|
cd "$SCRIPT_DIR" |
|
|
cd "$SCRIPT_DIR" |
|
|
|
|
|
|
|
|
|
|
|
# Detect docker compose command (new version: "docker compose" or old version: "docker-compose") |
|
|
|
|
|
if docker compose version >/dev/null 2>&1; then |
|
|
|
|
|
DOCKER_COMPOSE="docker compose" |
|
|
|
|
|
elif docker-compose version >/dev/null 2>&1; then |
|
|
|
|
|
DOCKER_COMPOSE="docker-compose" |
|
|
|
|
|
else |
|
|
|
|
|
echo "Error: Neither 'docker compose' nor 'docker-compose' command found" |
|
|
|
|
|
echo "Please install Docker Compose" |
|
|
|
|
|
exit 1 |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
echo "Using: $DOCKER_COMPOSE" |
|
|
|
|
|
|
|
|
# Define container names |
|
|
# Define container names |
|
|
MARKETING_CONTAINER="marketing-site-https" |
|
|
MARKETING_CONTAINER="marketing-site-https" |
|
|
NGINX_CONTAINER="nginx-https" |
|
|
NGINX_CONTAINER="nginx-https" |
|
|
@ -54,14 +67,28 @@ else |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
echo "" |
|
|
echo "" |
|
|
echo "Step 3: Starting services with docker-compose..." |
|
|
echo "Step 3: Cleaning up Docker images and build cache..." |
|
|
|
|
|
echo "----------------------------------------" |
|
|
|
|
|
|
|
|
|
|
|
# Remove dangling images (untagged images) |
|
|
|
|
|
echo "Removing dangling images..." |
|
|
|
|
|
docker image prune -f || true |
|
|
|
|
|
|
|
|
|
|
|
# Remove build cache to ensure fresh build |
|
|
|
|
|
echo "Removing build cache..." |
|
|
|
|
|
docker builder prune -f || true |
|
|
|
|
|
|
|
|
|
|
|
echo "" |
|
|
|
|
|
echo "Step 4: Starting services with docker-compose (no cache)..." |
|
|
echo "----------------------------------------" |
|
|
echo "----------------------------------------" |
|
|
|
|
|
|
|
|
# Start services with docker-compose (will automatically create network and volumes) |
|
|
# Start services with docker-compose (will automatically create network and volumes) |
|
|
docker-compose -f docker-compose-https.yml up -d --build |
|
|
# Use --no-cache to ensure fresh build without using cached layers |
|
|
|
|
|
$DOCKER_COMPOSE -f docker-compose-https.yml build --no-cache |
|
|
|
|
|
$DOCKER_COMPOSE -f docker-compose-https.yml up -d |
|
|
|
|
|
|
|
|
echo "" |
|
|
echo "" |
|
|
echo "Step 4: Checking container status..." |
|
|
echo "Step 5: Checking container status..." |
|
|
echo "----------------------------------------" |
|
|
echo "----------------------------------------" |
|
|
|
|
|
|
|
|
# Wait a few seconds for containers to start |
|
|
# Wait a few seconds for containers to start |
|
|
@ -76,9 +103,9 @@ echo "Deployment completed!" |
|
|
echo "==========================================" |
|
|
echo "==========================================" |
|
|
echo "" |
|
|
echo "" |
|
|
echo "View logs command:" |
|
|
echo "View logs command:" |
|
|
echo " docker-compose -f docker-compose-https.yml logs -f" |
|
|
echo " $DOCKER_COMPOSE -f docker-compose-https.yml logs -f" |
|
|
echo "" |
|
|
echo "" |
|
|
echo "Stop services command:" |
|
|
echo "Stop services command:" |
|
|
echo " docker-compose -f docker-compose-https.yml down" |
|
|
echo " $DOCKER_COMPOSE -f docker-compose-https.yml down" |
|
|
echo "" |
|
|
echo "" |
|
|
|
|
|
|
|
|
|