- Replace git.michaelschiemer.de:5000 (HTTP) with registry.michaelschiemer.de (HTTPS) - Update all Ansible playbooks and configuration files - Update CI/CD workflows to use HTTPS registry endpoint - Update Docker Compose files with new registry URL - Update documentation and scripts Benefits: - Secure HTTPS connection (no insecure registry config needed) - Consistent use of HTTPS endpoint via Traefik - Better security practices for production deployment
61 lines
1.7 KiB
Bash
Executable File
61 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
# Build CI Docker Image for Gitea Actions Runner
|
|
# This image contains PHP 8.5, Composer, Ansible, and other CI tools
|
|
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
IMAGE_NAME="${CI_IMAGE_NAME:-php-ci:latest}"
|
|
REGISTRY="${CI_REGISTRY:-registry.michaelschiemer.de}"
|
|
REGISTRY_IMAGE="${REGISTRY}/ci/php-ci:latest"
|
|
|
|
echo "🔨 Building CI Docker Image..."
|
|
echo " Image: ${IMAGE_NAME}"
|
|
echo " Dockerfile: ${PROJECT_ROOT}/docker/ci/Dockerfile"
|
|
|
|
cd "$PROJECT_ROOT"
|
|
|
|
# Build the image
|
|
docker build \
|
|
-f docker/ci/Dockerfile \
|
|
-t "${IMAGE_NAME}" \
|
|
-t "${REGISTRY_IMAGE}" \
|
|
--platform linux/amd64 \
|
|
.
|
|
|
|
echo ""
|
|
echo "✅ Image built successfully!"
|
|
echo ""
|
|
echo "📋 Next steps:"
|
|
echo ""
|
|
echo "1. Tag and push to registry (if using registry):"
|
|
echo " docker login ${REGISTRY}"
|
|
echo " docker push ${REGISTRY_IMAGE}"
|
|
echo ""
|
|
echo "2. Update GITEA_RUNNER_LABELS in .env:"
|
|
echo " Add: php-ci:docker://${IMAGE_NAME}"
|
|
echo ""
|
|
echo "3. Or use registry image:"
|
|
echo " Add: php-ci:docker://${REGISTRY_IMAGE}"
|
|
echo ""
|
|
echo "4. Restart runner to pick up new labels:"
|
|
echo " cd deployment/gitea-runner"
|
|
echo " ./unregister.sh"
|
|
echo " # Update .env with new labels"
|
|
echo " ./register.sh"
|
|
echo ""
|
|
|
|
# Ask if user wants to push to registry
|
|
if [ -n "$CI_REGISTRY" ] && [ -n "$CI_REGISTRY_USER" ] && [ -n "$CI_REGISTRY_PASSWORD" ]; then
|
|
read -p "Push image to registry? (y/N) " -n 1 -r
|
|
echo
|
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
echo "🔐 Logging in to registry..."
|
|
echo "$CI_REGISTRY_PASSWORD" | docker login "$REGISTRY" -u "$CI_REGISTRY_USER" --password-stdin
|
|
echo "📤 Pushing image..."
|
|
docker push "${REGISTRY_IMAGE}"
|
|
echo "✅ Image pushed to ${REGISTRY_IMAGE}"
|
|
fi
|
|
fi
|