63 lines
2.1 KiB
YAML
63 lines
2.1 KiB
YAML
kind: pipeline
|
|
type: docker
|
|
name: ci-cd-full
|
|
|
|
steps:
|
|
# ШАГ 1: Сборка и пуш образа в Gitea Registry
|
|
- name: docker-build
|
|
image: plugins/docker
|
|
pull: always
|
|
settings:
|
|
registry: gitea.allowlgroup.ru
|
|
repo: gitea.allowlgroup.ru/na-granicelife.ru/front
|
|
tags:
|
|
- latest
|
|
- "${DRONE_TARGET_BRANCH:-main}"
|
|
username:
|
|
from_secret: registry_username
|
|
password:
|
|
from_secret: registry_password
|
|
|
|
# ШАГ 2: Деплой на сервер (выполнится ТОЛЬКО если Шаг 1 успешен)
|
|
- name: ssh-deploy
|
|
image: appleboy/drone-ssh:1.7
|
|
pull: always
|
|
settings:
|
|
host:
|
|
from_secret: deploy_host
|
|
port:
|
|
from_secret: deploy_port
|
|
user:
|
|
from_secret: deploy_user
|
|
password:
|
|
from_secret: deploy_password
|
|
script_stop: true
|
|
script:
|
|
# 1. Создаем структуру папок в домашней директории (там точно есть права)
|
|
- mkdir -p ~/na-granicelife/assets/mp4
|
|
|
|
# 2. Клонируем код во временную папку
|
|
- rm -rf /tmp/na-granice-deploy
|
|
- git clone --depth 1 --branch main https://gitea.allowlgroup.ru/na-granicelife.ru/front.git /tmp/na-granice-deploy
|
|
|
|
# 3. Копируем файлы, КРОМЕ папки с видео (используем find+cp, чтобы не ставить rsync)
|
|
# Это безопасно: видео не перезапишется и не удалится
|
|
- find /tmp/na-granice-deploy -type f -not -path '*assets/mp4*' -exec cp --no-preserve=mode {} ~/na-granicelife \;
|
|
|
|
# 4. Чистим временную папку
|
|
- rm -rf /tmp/na-granice-deploy
|
|
|
|
# 5. Деплоим через docker compose
|
|
- cd ~/na-granicelife
|
|
- docker compose pull web
|
|
- docker compose up -d
|
|
- docker image prune -f
|
|
- docker compose ps
|
|
|
|
trigger:
|
|
branch:
|
|
- main
|
|
event:
|
|
- push
|
|
- custom
|