portainer-mcp/push-to-registry.sh
Adolfo Delorenzo 10dfd606c0 feat: streamline Docker deployment with registry images and unified env configuration
- Update docker-compose.yml to use pre-built images from GitLab registry
- Replace individual environment variables with unified env_file directive
- Create comprehensive .env.example with detailed instructions and troubleshooting
- Add push-to-registry.sh script for building and pushing images to registry
- Add docker-compose.prod.yml as reference for production deployments
- Update documentation to reflect simplified deployment process

Users can now deploy with just:
  cp .env.example .env
  docker-compose pull
  docker-compose up -d

All 7 MCP server images are available at:
  git.oe74.net/adelorenzo/portainer-mcp/portainer-*:latest

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-21 15:16:15 -03:00

70 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
# Build and push Portainer MCP Docker images to GitLab container registry
set -e
# Configuration
REGISTRY="git.oe74.net/adelorenzo/portainer-mcp"
VERSION="${1:-latest}"
# 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}Building and pushing Portainer MCP Docker images to GitLab registry${NC}"
echo -e "${BLUE}Registry: ${REGISTRY}${NC}"
echo -e "${BLUE}Version: ${VERSION}${NC}"
echo ""
# Check if logged in to registry
echo -e "${YELLOW}Checking GitLab registry login...${NC}"
if ! docker login git.oe74.net 2>/dev/null; then
echo -e "${RED}Please login to GitLab registry first:${NC}"
echo "docker login git.oe74.net"
exit 1
fi
# Function to build and push a single image
build_and_push() {
local service=$1
local image_name="${REGISTRY}/portainer-${service}"
echo -e "${BLUE}Building portainer-${service}...${NC}"
docker build -f docker/Dockerfile.${service} -t ${image_name}:${VERSION} .
if [ "${VERSION}" != "latest" ]; then
docker tag ${image_name}:${VERSION} ${image_name}:latest
fi
echo -e "${BLUE}Pushing portainer-${service} to registry...${NC}"
docker push ${image_name}:${VERSION}
if [ "${VERSION}" != "latest" ]; then
docker push ${image_name}:latest
fi
echo -e "${GREEN}✓ portainer-${service} pushed successfully${NC}"
echo ""
}
# Build and push all services
services=("core" "environments" "docker" "kubernetes" "stacks" "edge" "gitops")
for service in "${services[@]}"; do
build_and_push "${service}"
done
echo -e "${GREEN}All images built and pushed successfully!${NC}"
echo ""
echo "Images available at:"
for service in "${services[@]}"; do
echo " ${REGISTRY}/portainer-${service}:${VERSION}"
done
echo ""
echo "To use these images, update your docker-compose.yml:"
echo " image: ${REGISTRY}/portainer-core:${VERSION}"
echo " # instead of build: ..."