feat: container registry deploy (build in CI, pull on server)
Deploy / deploy (push) Has been cancelled
ci / build (push) Has been cancelled

This commit is contained in:
2026-06-13 20:56:04 +03:00
parent ca6b5f40c3
commit 0f73ca72d7
9 changed files with 143 additions and 3 deletions
+36
View File
@@ -0,0 +1,36 @@
---
- name: Deploy Frontend
hosts: prod
vars:
deploy_path: /opt/app
tasks:
- name: Ensure deployment directory
ansible.builtin.file:
path: "{{ deploy_path }}"
state: directory
- name: Copy docker-compose
ansible.builtin.copy:
src: "{{ playbook_dir }}/../docker-compose.yml"
dest: "{{ deploy_path }}/docker-compose.yml"
- name: Login to registry
ansible.builtin.shell:
cmd: echo "{{ registry_password }}" | docker login "{{ registry }}" -u "{{ registry_user }}" --password-stdin
- name: Pull images
ansible.builtin.shell:
cmd: docker compose pull
chdir: "{{ deploy_path }}"
environment:
REGISTRY: "{{ registry }}"
TAG: "{{ tag }}"
- name: Restart services
ansible.builtin.shell:
cmd: docker compose up -d --remove-orphans
chdir: "{{ deploy_path }}"
environment:
REGISTRY: "{{ registry }}"
TAG: "{{ tag }}"