From 94ea381348e4a497e1bd0cdd32201ecfb79ebb93 Mon Sep 17 00:00:00 2001 From: Chris Anderson Date: Wed, 24 Jun 2026 10:28:07 +0200 Subject: [PATCH] Add deploy script and simplify Gitea workflow - Added deploy.sh for manual deployment - Simplified Gitea Actions workflow - Note: Gitea Actions Docker builds have networking issues - Manual deployment via deploy.sh works perfectly Co-Authored-By: Paperclip --- .gitea/workflows/deploy.yml | 29 +++++++++++++++++++++-------- deploy.sh | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 8 deletions(-) create mode 100644 deploy.sh diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 8401fbaa..8b639ec3 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -1,15 +1,12 @@ -name: Build hatch.surf +name: Deploy hatch.surf on: push: branches: [main] workflow_dispatch: -env: - IMAGE_NAME: hatch-web - jobs: - build: + deploy: runs-on: ubuntu-latest steps: @@ -18,7 +15,23 @@ jobs: - name: Build Docker image run: | - docker build -t ${{ env.IMAGE_NAME }}:${{ github.sha }} . - docker tag ${{ env.IMAGE_NAME }}:${{ github.sha }} ${{ env.IMAGE_NAME }}:latest + docker build -t hatch-web:latest . echo "Docker image built successfully" - docker images | grep ${{ env.IMAGE_NAME }} + + - name: Deploy container + run: | + docker stop hatch-web 2>/dev/null || true + docker rm hatch-web 2>/dev/null || true + docker compose up -d + echo "Container deployed" + + - name: Verify deployment + run: | + sleep 5 + if curl -s -o /dev/null -w "%{http_code}" http://localhost:8080 | grep -q "200"; then + echo "✅ hatch.surf deployed successfully!" + else + echo "❌ Deployment failed!" + docker logs hatch-web + exit 1 + fi diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 00000000..2cb3f235 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# Deploy hatch.surf +# Run this script to build and deploy the Docker container + +set -e + +echo "=== Deploying hatch.surf ===" + +# Build the Docker image +echo "Building Docker image..." +docker build -t hatch-web:latest . + +# Stop existing container +echo "Stopping existing container..." +docker stop hatch-web 2>/dev/null || true +docker rm hatch-web 2>/dev/null || true + +# Start new container +echo "Starting new container..." +docker compose up -d + +# Wait for health check +echo "Waiting for container to be healthy..." +sleep 5 + +# Verify +if curl -s -o /dev/null -w "%{http_code}" http://localhost:8080 | grep -q "200"; then + echo "✅ hatch.surf deployed successfully!" + echo " Container: hatch-web" + echo " Port: 8080" + echo " Status: $(curl -s -o /dev/null -w "%{http_code}" http://localhost:8080)" +else + echo "❌ Deployment failed!" + docker logs hatch-web + exit 1 +fi