Files
crepes-demo/deploy.sh
OpenClaw 9b750238c2
Some checks failed
Build and Push Docker Image / build (push) Has been cancelled
Initial commit: json-render crepes demo
2026-02-09 07:30:54 +01:00

73 lines
2.2 KiB
Bash
Executable File

#!/bin/bash
set -e
# Colors for output
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
echo -e "${BLUE}🥞 Crêpes Demo Deployment Script${NC}\n"
# Check if registry is provided
if [ -z "$1" ]; then
echo -e "${RED}Error: Please provide your container registry${NC}"
echo -e "Usage: ./deploy.sh YOUR_REGISTRY [domain]"
echo -e "Example: ./deploy.sh ghcr.io/username crepes.example.com"
exit 1
fi
REGISTRY=$1
DOMAIN=${2:-crepes.yourdomain.com}
IMAGE_NAME="crepes-demo"
TAG="latest"
echo -e "${YELLOW}Configuration:${NC}"
echo -e " Registry: ${BLUE}${REGISTRY}${NC}"
echo -e " Image: ${BLUE}${REGISTRY}/${IMAGE_NAME}:${TAG}${NC}"
echo -e " Domain: ${BLUE}${DOMAIN}${NC}\n"
# Step 1: Build Docker image
echo -e "${GREEN}Step 1: Building Docker image...${NC}"
docker build -t ${IMAGE_NAME}:${TAG} .
# Step 2: Tag image
echo -e "${GREEN}Step 2: Tagging image...${NC}"
docker tag ${IMAGE_NAME}:${TAG} ${REGISTRY}/${IMAGE_NAME}:${TAG}
# Step 3: Push to registry
echo -e "${GREEN}Step 3: Pushing to registry...${NC}"
docker push ${REGISTRY}/${IMAGE_NAME}:${TAG}
# Step 4: Update manifests
echo -e "${GREEN}Step 4: Updating Kubernetes manifests...${NC}"
# Update deployment.yaml
sed -i.bak "s|image: .*crepes-demo.*|image: ${REGISTRY}/${IMAGE_NAME}:${TAG}|g" k8s/deployment.yaml
# Update ingress.yaml
sed -i.bak "s|crepes\.yourdomain\.com|${DOMAIN}|g" k8s/ingress.yaml
# Clean up backup files
rm -f k8s/*.bak
echo -e "${GREEN}Manifests updated!${NC}\n"
# Step 5: Prompt for Git operations
echo -e "${YELLOW}Next steps:${NC}"
echo -e "1. Review the updated manifests in k8s/"
echo -e "2. Commit and push to your Git repository:"
echo -e " ${BLUE}git add .${NC}"
echo -e " ${BLUE}git commit -m 'Update deployment configuration'${NC}"
echo -e " ${BLUE}git push${NC}"
echo -e "3. Apply Flux resources to your cluster:"
echo -e " ${BLUE}kubectl apply -f flux/gitrepository.yaml${NC}"
echo -e " ${BLUE}kubectl apply -f flux/kustomization.yaml${NC}"
echo -e "4. Watch the deployment:"
echo -e " ${BLUE}flux get kustomizations -w${NC}\n"
echo -e "${GREEN}✅ Build and push complete!${NC}"
echo -e "${BLUE}Your app will be available at: https://${DOMAIN}${NC}"