Update deployment to rsync-based NAS deployment
- Replace Docker Hub CI/CD with direct NAS deployment - Use rsync for reliable file synchronization - Add SSH-based remote docker-compose execution - Configure for Synology NAS volume path structure 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
56eaf8c9b5
commit
7d4d77ce1b
59
.github/workflows/deploy.yml
vendored
59
.github/workflows/deploy.yml
vendored
@ -1,44 +1,31 @@
|
|||||||
name: Deploy Nginx
|
name: Deploy to NAS (rsync)
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches:
|
||||||
workflow_dispatch:
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Setup SSH key
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: webfactory/ssh-agent@v0.9.0
|
||||||
|
with:
|
||||||
- name: Login to Docker Hub
|
ssh-private-key: ${{ secrets.NAS_SSH_KEY_ADMIN }}
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
- name: Rsync to NAS
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
run: |
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
rsync -avz -e "ssh -o StrictHostKeyChecking=no -p ${{ secrets.NAS_PORT }}" ./ \
|
||||||
|
${{ secrets.NAS_USER }}@${{ secrets.NAS_HOST }}:/volume1/homes/admin/nginx-infra/
|
||||||
- name: Build and push Nginx
|
|
||||||
uses: docker/build-push-action@v5
|
- name: Remote docker-compose up
|
||||||
with:
|
run: |
|
||||||
context: ./nginx
|
ssh -o StrictHostKeyChecking=no -p ${{ secrets.NAS_PORT }} ${{ secrets.NAS_USER }}@${{ secrets.NAS_HOST }} << 'EOF'
|
||||||
push: true
|
cd /volume1/homes/admin/nginx-infra
|
||||||
tags: |
|
docker-compose up -d --build
|
||||||
${{ secrets.DOCKER_USERNAME }}/robeing-nginx:latest
|
EOF
|
||||||
${{ secrets.DOCKER_USERNAME }}/robeing-nginx:${{ github.sha }}
|
|
||||||
|
|
||||||
- name: Update docker-compose.yml
|
|
||||||
run: |
|
|
||||||
sed -i "s|image: .*/robeing-nginx:.*|image: ${{ secrets.DOCKER_USERNAME }}/robeing-nginx:${{ github.sha }}|g" docker-compose.yml
|
|
||||||
|
|
||||||
- name: Commit and push changes
|
|
||||||
run: |
|
|
||||||
git config --local user.email "action@github.com"
|
|
||||||
git config --local user.name "GitHub Action"
|
|
||||||
git add docker-compose.yml
|
|
||||||
git commit -m "Update nginx image to ${{ github.sha }}" || exit 0
|
|
||||||
git push
|
|
||||||
Loading…
x
Reference in New Issue
Block a user