Files
Touchh/.drone.yml
2025-07-19 18:34:51 +09:00

104 lines
2.4 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

kind: pipeline
name: Touchh Hotel AntiFraud Pipeline
namespace: touchh
steps:
# Шаг 1: Клонирование репозитория
- name: clone_repo
image: alpine/git
commands:
- if [ ! -d .git ]; then git clone $DRONE_REPO_URL .; fi
- git fetch --all
- git reset --hard $DRONE_COMMIT
# Шаг 2: Обновление и запуск с помощью update.sh
- name: docker-build
image: plugins/docker
settings:
repo: trevor198507/touchh-py
dry_run: true
- ./bin/update
# Шаг 3: Миграция базы данных
- name: run_migrations
image: docker:24
environment:
MYSQL_PASSWORD: touchh
volumes:
- name: docker_sock
path: /var/run/docker.sock
depends_on:
- web
commands:
- apk add --no-cache bash
- until docker inspect -f '{{.State.Running}}' src-web-1 | grep true; do echo "Waiting for container to be running..."; sleep 5; done
- chmod +x ./bin/cli
- ./bin/cli migrate
# Шаг 4: Тестирование
- name: run_tests
image: python:3.12-alpine
environment:
MYSQL_PASSWORD: touchh
depends_on:
- db
commands:
- apk add --no-cache mariadb-client mariadb-connector-c-dev gcc musl-dev pkgconfig
- pip install -r requirements.txt
- python manage.py test
services:
# Сервис базы данных
- name: db
image: mariadb:11.6
environment:
MYSQL_RANDOM_ROOT_PASSWORD: 1
MYSQL_DATABASE: touchh
MYSQL_USER: touchh
MYSQL_PASSWORD: touchh
volumes:
- name: mysql_data
temp: {}
# Сервис Django (Web)
- name: web
image: touchh-py
environment:
MYSQL_PASSWORD: touchh
command: ['python3', 'manage.py', 'runserver', '0.0.0.0:8000']
ports:
- port: 8000
depends_on:
- db
volumes:
- name: app_volume
path: /app
# Сервис Telegram Bot
- name: bot
image: touchh-py
environment:
MYSQL_PASSWORD: touchh
command: ['python3', 'manage.py', 'run_bot']
depends_on:
- db
# Сервис планировщика задач
- name: scheduler
image: touchh-py
environment:
MYSQL_PASSWORD: touchh
command: ['python3', 'manage.py', 'start_scheduler']
depends_on:
- db
volumes:
- name: docker_sock
host:
path: /var/run/docker.sock
- name: mysql_data
temp: {}
- name: app_volume
host:
path: ./