xrg.es/.drone.yml

98 lines
2.1 KiB
YAML

kind: pipeline
type: docker
name: build
steps:
- name: backend
image: composer:2.1.14
commands:
- cd backend && composer install && composer dump-autoload --classmap-authoritative && composer dump-env prod && rm -rf var/cache/prod
- name: frontend
image: node:16.13.1-alpine
commands:
- cd frontend && npm install && npm run build
- name: build-php-image
image: plugins/docker
settings:
dockerfile: docker/Dockerfile.php
auto_tag: true
repo: registry.xrg.io/xrges/php
registry: https://registry.xrg.io
username:
from_secret: registry_username
password:
from_secret: registry_password
depends_on:
- frontend
- backend
- name: build-nginx-image
image: plugins/docker
settings:
dockerfile: docker/Dockerfile.nginx
auto_tag: true
repo: registry.xrg.io/xrges/nginx
registry: https://registry.xrg.io
username:
from_secret: registry_username
password:
from_secret: registry_password
depends_on:
- frontend
- backend
- name: build-redis-image
image: plugins/docker
settings:
dockerfile: docker/Dockerfile.redis
auto_tag: true
repo: registry.xrg.io/xrges/redis
registry: https://registry.xrg.io
username:
from_secret: registry_username
password:
from_secret: registry_password
depends_on:
- frontend
- backend
node:
location: home
---
kind: pipeline
type: docker
name: deploy
steps:
- name: run
image: docker/compose:1.29.2
environment:
username:
from_secret: registry_username
password:
from_secret: registry_password
commands:
- echo $username
- docker login -u $username -p $password https://registry.xrg.io
- docker-compose -f docker/docker-compose.prod.yml stop
#- docker-compose -f docker/docker-compose.prod.yml rm -f
- docker-compose -f docker/docker-compose.prod.yml pull
- docker-compose -f docker/docker-compose.prod.yml up -d
volumes:
- name: host_docker_sock
path: /var/run/docker.sock
volumes:
- name: host_docker_sock
host:
path: /var/run/docker.sock
node:
location: do1
depends_on:
- build