Change deploy to use ansible

This commit is contained in:
2025-04-13 11:06:20 +03:00
parent fdb82bddf5
commit f523f6c39a
2 changed files with 13 additions and 51 deletions

View File

@@ -113,7 +113,18 @@ tasks:
sh: git rev-parse --short HEAD
TIMESTAMP:
sh: date +%s
IMAGE_TAG: homepage-nginx:{{.COMMIT_HASH}}-{{.TIMESTAMP}}
DOCKER_IMAGE: homepage-nginx:{{.COMMIT_HASH}}-{{.TIMESTAMP}}
cmds:
- task: build-prod
- docker build --pull --file docker/Dockerfile.nginx.prod --tag {{.IMAGE_TAG}} .
- docker build --pull --file docker/Dockerfile.nginx.prod --tag {{.DOCKER_IMAGE}} .
- task: deploy-with-ansible
vars:
DOCKER_IMAGE: '{{.DOCKER_IMAGE}}'
deploy-with-ansible:
internal: true
requires:
vars: [DOCKER_IMAGE]
dir: '/home/av/projects/private/pet-project-server'
cmd: ansible-playbook -i production.yml playbook-app-homepage.yml --extra-vars 'homepage_web_image={{.DOCKER_IMAGE}}'