Skip to content

feat: redesign frontend UI with red-white theme inspired by HuggingFace #22

feat: redesign frontend UI with red-white theme inspired by HuggingFace

feat: redesign frontend UI with red-white theme inspired by HuggingFace #22

Workflow file for this run

name: Build & Deploy
on:
push:
branches: [main]
env:
REGISTRY: ghcr.io
IMAGE_PREFIX: ghcr.io/open-shadow/camel
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build & push backend image
uses: docker/build-push-action@v6
with:
context: ./backend
file: ./backend/Dockerfile.prod
push: true
tags: |
${{ env.IMAGE_PREFIX }}-backend:latest
${{ env.IMAGE_PREFIX }}-backend:${{ github.sha }}
cache-from: type=gha,scope=backend
cache-to: type=gha,mode=max,scope=backend
- name: Build & push frontend image
uses: docker/build-push-action@v6
with:
context: ./frontend
file: ./frontend/Dockerfile.prod
push: true
tags: |
${{ env.IMAGE_PREFIX }}-frontend:latest
${{ env.IMAGE_PREFIX }}-frontend:${{ github.sha }}
build-args: |
VITE_API_URL=/api
cache-from: type=gha,scope=frontend
cache-to: type=gha,mode=max,scope=frontend
deploy:
needs: build-and-push
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Sync compose file to server
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SERVER_SSH_KEY }}
source: "deploy/docker-compose.server.yml"
target: "/tmp/camel-deploy-sync"
strip_components: 1
- name: Deploy to server via SSH
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SERVER_SSH_KEY }}
script: |
set -e
cd ~/camel-deploy
# Sync compose file from repo
cp /tmp/camel-deploy-sync/docker-compose.server.yml docker-compose.yml
rm -rf /tmp/camel-deploy-sync
# Login to ghcr.io
echo "${{ secrets.GHCR_PAT }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
# Pull latest images
docker compose pull backend frontend
# Restart services — backend entrypoint (start-web.sh) handles migrate + collectstatic
docker compose up -d --remove-orphans
# Wait for backend to be healthy
for i in $(seq 1 30); do
if docker compose exec -T backend python -c "import django; django.setup()" 2>/dev/null; then
echo "Backend is healthy after ${i}s"
break
fi
if [ "$i" = "30" ]; then
echo "WARNING: Backend health check timed out after 30s"
docker compose logs --tail=30 backend
fi
sleep 1
done
docker compose ps
# Clean up old images
docker image prune -f
echo "Deployment complete!"