This commit is contained in:
Joe_Peach committed 2026-05-25 23:54:48 +03:00
commit ad7be5b9ab
2 files changed
+37 -1

No files matched your search

+22 -1
View File
@@ -28,7 +28,7 @@ jobs:
id: tags id: tags
uses: https://github.com/cssnr/docker-tags-action@v2 uses: https://github.com/cssnr/docker-tags-action@v2
with: with:
images: 'git.rustprogersteam.ru/pvhproject/pvhfrontend/' images: 'git.rustprogersteam.ru/pvhproject/pvhbackend/'
- name: Login to Docker Registry - name: Login to Docker Registry
uses: docker/login-action@v3 uses: docker/login-action@v3
@@ -51,3 +51,24 @@ jobs:
labels: ${{ steps.tags.outputs.labels }} labels: ${{ steps.tags.outputs.labels }}
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
deploy:
needs: docker-build-and-push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Ansible
run: apt-get update && apt-get install -y ansible
- name: Set up SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
- name: Trust server host key
run: |
ssh-keyscan -H ${{ secrets.SERVER_IP }} >> ~/.ssh/known_hosts
- name: Run Ansible playbook
run: |
ansible-playbook -i "${{ secrets.SERVER_IP }}," ansible/restart_compose.yml \
--user "${{ secrets.SERVER_USER }}" \
--private-key ~/.ssh/deploy_key
+15
View File
@@ -0,0 +1,15 @@
- name: Restart Docker Compose services
hosts: all
# become: yes # <-- больше не нужно, т.к. пользователь уже имеет права Docker
tasks:
- name: docker compose down
ansible.builtin.shell:
cmd: docker compose down pvh-frontend
chdir: /etc/compose/pvh
- name: prune system
ansible.builtin.shell:
cmd: docker system prune -a -f
- name: docker compose up -d
ansible.builtin.shell:
cmd: docker compose up -d pvh-frontend
chdir: /etc/compose/pvh