container lifecycle management
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
set -e
|
||||
|
||||
DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
ROOT_DIR="$(cd "$DIR/.." && pwd)"
|
||||
|
||||
echo "Building all container images..."
|
||||
echo
|
||||
@@ -13,5 +14,31 @@ echo
|
||||
"$DIR/build" ingestor "$@"
|
||||
"$DIR/build" web "$@"
|
||||
|
||||
# Build lifecycle-sidecar (Go binary, no protobuf sync needed)
|
||||
echo "Building lifecycle-sidecar..."
|
||||
cd "$ROOT_DIR/lifecycle-sidecar"
|
||||
|
||||
# Determine tag
|
||||
if [ "$1" == "dev" ]; then
|
||||
TAG="dev$(date +%Y%m%d%H%M%S)"
|
||||
else
|
||||
# Check for uncommitted changes
|
||||
DIRTY="$(git status | grep 'Changes ' || true)"
|
||||
if [ "$DIRTY" != "" ]; then
|
||||
echo "lifecycle-sidecar has uncommitted changes."
|
||||
echo "Use '$0 dev' to build a development-tagged version instead."
|
||||
exit 1
|
||||
fi
|
||||
TAG="$(git log --oneline | head -1 | cut -d ' ' -f 1)"
|
||||
fi
|
||||
|
||||
REMOTE=${REMOTE:-ghcr.io/dexorder}
|
||||
|
||||
docker build -t lifecycle-sidecar:latest -t lifecycle-sidecar:$TAG .
|
||||
docker tag lifecycle-sidecar:$TAG $REMOTE/lifecycle-sidecar:$TAG
|
||||
docker tag $REMOTE/lifecycle-sidecar:$TAG $REMOTE/lifecycle-sidecar:latest
|
||||
|
||||
echo "$(date)" built $REMOTE/lifecycle-sidecar:$TAG
|
||||
|
||||
echo
|
||||
echo "All images built successfully!"
|
||||
|
||||
17
bin/dev
17
bin/dev
@@ -19,7 +19,7 @@ usage() {
|
||||
echo "Commands:"
|
||||
echo " start Start minikube and deploy all services"
|
||||
echo " stop Stop minikube"
|
||||
echo " restart [svc] Rebuild and redeploy all services, or just one (relay|ingestor|flink)"
|
||||
echo " restart [svc] Rebuild and redeploy all services, or just one (relay|ingestor|flink|sidecar)"
|
||||
echo " rebuild [svc] Rebuild all custom images, or just one"
|
||||
echo " deploy [svc] Deploy/update all services, or just one"
|
||||
echo " status Show status of all services"
|
||||
@@ -127,12 +127,23 @@ rebuild_images() {
|
||||
docker tag "dexorder/ai-flink:$FLINK_TAG" "dexorder/flink:$FLINK_TAG"
|
||||
fi
|
||||
|
||||
# Save the tags for deployment (all three, preserving any we didn't rebuild)
|
||||
# Build lifecycle-sidecar (Go binary)
|
||||
if [ "$service" == "all" ] || [ "$service" == "lifecycle-sidecar" ] || [ "$service" == "sidecar" ]; then
|
||||
echo -e "${GREEN}→${NC} Building lifecycle-sidecar..."
|
||||
cd "$ROOT_DIR/lifecycle-sidecar"
|
||||
SIDECAR_TAG="dev$(date +%Y%m%d%H%M%S)"
|
||||
docker build -t lifecycle-sidecar:latest -t lifecycle-sidecar:$SIDECAR_TAG . || exit 1
|
||||
echo -e "${GREEN}✓ Built lifecycle-sidecar:$SIDECAR_TAG${NC}"
|
||||
cd "$ROOT_DIR"
|
||||
fi
|
||||
|
||||
# Save the tags for deployment (all services, preserving any we didn't rebuild)
|
||||
echo "RELAY_TAG=$RELAY_TAG" > "$ROOT_DIR/.dev-image-tag"
|
||||
echo "INGEST_TAG=$INGEST_TAG" >> "$ROOT_DIR/.dev-image-tag"
|
||||
echo "FLINK_TAG=$FLINK_TAG" >> "$ROOT_DIR/.dev-image-tag"
|
||||
echo "SIDECAR_TAG=$SIDECAR_TAG" >> "$ROOT_DIR/.dev-image-tag"
|
||||
|
||||
echo -e "${GREEN}✓ Images built: relay=$RELAY_TAG, ingestor=$INGEST_TAG, flink=$FLINK_TAG${NC}"
|
||||
echo -e "${GREEN}✓ Images built: relay=$RELAY_TAG, ingestor=$INGEST_TAG, flink=$FLINK_TAG, sidecar=$SIDECAR_TAG${NC}"
|
||||
}
|
||||
|
||||
deploy_services() {
|
||||
|
||||
Reference in New Issue
Block a user