Files
front/.drone.yml
T
Uroboros 73d2b33b75
continuous-integration/drone/push Build is passing
test6
2026-10-07 21:16:40 +10:00

62 lines
1.8 KiB
YAML

kind: pipeline
type: docker
name: ci-cd-full
steps:
# Step 1: Build and push image to 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_COMMIT_SHA}
username:
from_secret: registry_username
password:
from_secret: registry_password
# Step 2: Deploy via SSH
- 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: |
set -e
APP_DIR="$HOME/na-granicelife"
TMP_DIR="/tmp/na-granice-deploy"
mkdir -p "$APP_DIR/assets/mp4"
rm -rf "$TMP_DIR"
git clone --depth 1 --branch main https://gitea.allowlgroup.ru/na-granicelife.ru/front.git "$TMP_DIR"
tar -C "$TMP_DIR" -cf - --exclude=./.git --exclude=./assets/mp4 . | tar -C "$APP_DIR" -xf -
rm -rf "$TMP_DIR"
cd "$APP_DIR"
docker compose pull web
# Принудительно освобождаем порт 3000
docker stop na-granicelife 2>/dev/null || true
docker rm na-granicelife 2>/dev/null || true
docker compose down --remove-orphans || true
# Если порт всё ещё занят — убиваем любой процесс на нём
docker ps -a --filter "publish=3000" -q | xargs -r docker stop 2>/dev/null || true
docker compose up -d
docker image prune -f
docker compose ps
trigger:
branch:
- main
event:
- push
- custom