+23
-19
@@ -12,7 +12,7 @@ steps:
|
||||
repo: gitea.allowlgroup.ru/na-granicelife.ru/front
|
||||
tags:
|
||||
- latest
|
||||
- "${DRONE_TARGET_BRANCH:-main}"
|
||||
- ${DRONE_COMMIT_SHA}
|
||||
username:
|
||||
from_secret: registry_username
|
||||
password:
|
||||
@@ -32,26 +32,30 @@ steps:
|
||||
password:
|
||||
from_secret: deploy_password
|
||||
script_stop: true
|
||||
# The pipe '|' ensures the whole block is sent as a script to the server
|
||||
script: |
|
||||
# 1. Create directory structure in home folder (no permission issues here)
|
||||
mkdir -p ~/na-granicelife/assets/mp4
|
||||
|
||||
# 2. Clone code to temp folder on the server
|
||||
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. Copy all files EXCEPT the mp4 folder
|
||||
# find locates files, -not excludes the mp4 path, cp copies them
|
||||
find /tmp/na-granice-deploy -type f -not -path '*assets/mp4*' -exec cp --no-preserve=mode {} ~/na-granicelife \;
|
||||
|
||||
# 4. Clean up temp folder
|
||||
rm -rf /tmp/na-granice-deploy
|
||||
|
||||
# 5. Run docker compose commands directly on the server
|
||||
cd ~/na-granicelife
|
||||
set -e
|
||||
|
||||
APP_DIR="$HOME/na-granicelife"
|
||||
TMP_DIR="/tmp/na-granice-deploy"
|
||||
|
||||
# 1. Сохраняем mp4 перед обновлением файлов
|
||||
mkdir -p "$APP_DIR/assets/mp4"
|
||||
|
||||
# 2. Клонируем свежую версию репозитория
|
||||
rm -rf "$TMP_DIR"
|
||||
git clone --depth 1 --branch main https://gitea.allowlgroup.ru/na-granicelife.ru/front.git "$TMP_DIR"
|
||||
|
||||
# 3. Копируем всё, кроме mp4 и .git (tar preserves directory structure)
|
||||
tar -C "$TMP_DIR" -cf - --exclude=./.git --exclude=./assets/mp4 . \
|
||||
| tar -C "$APP_DIR" -xf -
|
||||
|
||||
# 4. Чистим временную директорию
|
||||
rm -rf "$TMP_DIR"
|
||||
|
||||
# 5. Пересобираем и перезапускаем контейнер
|
||||
cd "$APP_DIR"
|
||||
docker compose pull web
|
||||
docker compose up -d
|
||||
docker compose up -d --remove-orphans
|
||||
docker image prune -f
|
||||
docker compose ps
|
||||
|
||||
|
||||
Reference in New Issue
Block a user