sw-fe/deploy-frontend.sh

28 lines
650 B
Bash
Executable File

#!/bin/bash
set -e
cd /home/swire/sociowire-code/frontend-service/sociowire-frontend
echo "=== FRONTEND DEPLOY ==="
# 1. Build JS
echo "[1/4] Building frontend..."
npm run build
# 2. Generate unique version
VERSION="v$(date +%s)"
echo "[2/4] Version: $VERSION"
# 3. Build Docker image (no cache)
echo "[3/4] Building Docker image..."
docker build --no-cache -t sociowire/frontend:$VERSION .
# 4. Deploy
echo "[4/4] Deploying to swarm..."
docker service update --image sociowire/frontend:$VERSION sociowire_frontend
# Verify
echo ""
echo "=== DEPLOYED: sociowire/frontend:$VERSION ==="
docker service ps sociowire_frontend --no-trunc | head -3