puffinOffsetCalculator/gitea-image-push.sh

63 lines
2.1 KiB
Bash

#!/bin/bash
# Puffin Offset Calculator - Gitea Container Registry Push Script
# This script builds and pushes the Docker image to the Gitea container registry
echo "========================================"
echo "Puffin Offset Calculator - Gitea Push"
echo "========================================"
# Check if Docker is installed
if ! command -v docker &> /dev/null; then
echo "Error: Docker is not installed. Please install Docker first."
exit 1
fi
# Log in to Gitea registry
echo "Logging into Gitea container registry..."
echo "Please enter your Gitea credentials when prompted:"
docker login code.letsbe.solutions
if [ $? -ne 0 ]; then
echo "========================================"
echo "Error: Failed to log in to the Gitea registry."
echo "Please check your credentials and try again."
echo "========================================"
exit 1
fi
# Build the Docker image
echo "Building Docker image..."
docker build -t code.letsbe.solutions/matt/puffinoffsetcalculator:latest .
if [ $? -ne 0 ]; then
echo "========================================"
echo "Error: Failed to build the Docker image."
echo "Please check the error messages above and try again."
echo "========================================"
exit 1
fi
# Push the image to Gitea registry
echo "Pushing image to Gitea registry..."
docker push code.letsbe.solutions/matt/puffinoffsetcalculator:latest
if [ $? -eq 0 ]; then
echo "========================================"
echo "Success! Image pushed to Gitea registry."
echo ""
echo "The image is now available at: code.letsbe.solutions/matt/puffinoffsetcalculator:latest"
echo ""
echo "Next steps:"
echo "1. Copy setup.sh, docker-compose.yml, and nginx.conf to your server"
echo "2. Run the setup script on your server to deploy the container"
echo "3. Follow the WordPress integration steps in README.docker.md"
echo "========================================"
else
echo "========================================"
echo "Error: Failed to push the image to Gitea registry."
echo "Please check the error messages above and try again."
echo "========================================"
exit 1
fi