todolist-proto/deploy.sh

47 lines
1.3 KiB
Bash
Raw Normal View History

2026-01-20 18:40:33 +01:00
#!/bin/bash
# Load environment variables
if [ -f .env ]; then
export $(cat .env | grep -v '^#' | xargs)
else
echo "Error: .env file not found!"
echo "Please create .env file with PUBLISH_TOKEN variable."
echo "See .env.example for template."
exit 1
fi
if [ -z "$PUBLISH_TOKEN" ]; then
echo "Error: PUBLISH_TOKEN not set in .env file"
exit 1
fi
# Configuration
GITEA_SERVER="https://brokkr.robotico.dev"
GITEA_OWNER="dalex"
REGISTRY="${GITEA_SERVER}/${GITEA_OWNER}"
# Build images
echo "Building Docker images..."
docker-compose build
# Tag images for Gitea registry
echo "Tagging images for Gitea registry..."
docker tag todolist-proto-backend:latest ${REGISTRY}/dalex-todo-backend:latest
docker tag todolist-proto-frontend:latest ${REGISTRY}/dalex-todo-frontend:latest
# Login to Gitea registry
echo "Logging in to Gitea registry..."
echo "${PUBLISH_TOKEN}" | docker login ${GITEA_SERVER} -u dalex --password-stdin
# Push images
echo "Pushing backend image..."
docker push ${REGISTRY}/dalex-todo-backend:latest
echo "Pushing frontend image..."
docker push ${REGISTRY}/dalex-todo-frontend:latest
echo "Deployment complete!"
echo "Images published to:"
echo " - ${REGISTRY}/dalex-todo-backend:latest"
echo " - ${REGISTRY}/dalex-todo-frontend:latest"