ci auto build and deploy
Some checks failed
Build and deploy / Build and Push Docker Images (push) Has been cancelled

This commit is contained in:
2025-12-13 15:35:08 +05:00
parent 3934cbf3ae
commit 872ebc1971

View File

@@ -0,0 +1,45 @@
name: Build and deploy
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
jobs:
docker:
name: Build and Push Docker Images
runs-on: builder
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Login to Docker Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ vars.DOCKER_REGISTRY_URL }}
username: ${{ vars.DOCKER_REGISTRY_USER }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
- name: Build and push docker images
working-directory: .build/prod
run: docker compose --progress plain build --push
- name: Deploy production
if: github.event_name != 'pull_request'
run: |
ssh root@10.0.1.36 -t "cd /mnt && \
docker compose --progress plain pull && \
docker compose --progress plain down && \
docker compose --progress plain up -d"
- name: Clean up dangling images
if: github.event_name != 'pull_request'
run: ssh root@10.0.1.36 -t "docker image prune -f"