Update .gitea/workflows/deploy-remote.yml
Some checks failed
Build and Deploy Docker Image / build-and-push (push) Has been cancelled
Some checks failed
Build and Deploy Docker Image / build-and-push (push) Has been cancelled
This commit is contained in:
@@ -1,14 +1,11 @@
|
||||
name: Deploy to Remote Server
|
||||
|
||||
on:
|
||||
# Trigger after successful build (using workflow_run)
|
||||
workflow_run:
|
||||
workflows: ["Build and Deploy Docker Image"]
|
||||
types:
|
||||
- completed
|
||||
branches: ["main"]
|
||||
|
||||
# Allow manual trigger for redeployment
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
image_tag:
|
||||
@@ -21,12 +18,11 @@ env:
|
||||
IMAGE_NAME: vkrb/quantum_backend
|
||||
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
|
||||
REMOTE_USER: ${{ secrets.REMOTE_USER }}
|
||||
REMOTE_PORT: ${{ secrets.REMOTE_PORT }} # Add this
|
||||
REMOTE_PORT: ${{ secrets.REMOTE_PORT }}
|
||||
COMPOSE_PATH: /usr/local/share/vkrb/quantum_backend
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
# Only run if the build workflow succeeded
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -35,7 +31,7 @@ jobs:
|
||||
uses: appleboy/ssh-action@v1.0.3
|
||||
with:
|
||||
host: ${{ secrets.REMOTE_HOST }}
|
||||
port: ${{ secrets.REMOTE_PORT }} # Add this line
|
||||
port: ${{ secrets.REMOTE_PORT }}
|
||||
username: ${{ secrets.REMOTE_USER }}
|
||||
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
script_stop: true
|
||||
@@ -56,15 +52,17 @@ jobs:
|
||||
|
||||
echo "Deploying tag: $TAG"
|
||||
|
||||
# Method 1: Using environment variable (recommended)
|
||||
export IMAGE_TAG=$TAG
|
||||
docker compose pull app # Pull only the app service
|
||||
# Update .env file with the tag (if you're using env_file)
|
||||
echo "IMAGE_TAG=$TAG" > .env
|
||||
|
||||
# Redeploy with the new image
|
||||
docker compose up -d --no-deps --force-recreate app
|
||||
# Pull only the quantum-backend service (not 'app'!)
|
||||
docker compose pull quantum-backend
|
||||
|
||||
# Redeploy with the new image - use correct service name
|
||||
docker compose up -d --no-deps --force-recreate quantum-backend
|
||||
|
||||
# Clean up old images
|
||||
docker image prune -f
|
||||
|
||||
# Check container status
|
||||
docker compose ps
|
||||
docker compose ps
|
||||
Reference in New Issue
Block a user