+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
|
||||
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ WORKDIR /app
|
||||
# Сначала ставим зависимости отдельным слоем — кэш пересобирается
|
||||
# только при изменении package.json/package-lock.json
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
RUN npm ci --omit=dev --no-audit --no-fund
|
||||
|
||||
# Копируем исходники (список исключений — в .dockerignore)
|
||||
COPY . .
|
||||
|
||||
+11
-1
@@ -6,6 +6,9 @@ services:
|
||||
image: gitea.allowlgroup.ru/na-granicelife.ru/front:latest
|
||||
container_name: na-granicelife
|
||||
restart: unless-stopped
|
||||
# PID 1 = docker-init: корректно пробрасает SIGTERM на node
|
||||
# и собирает зомби-процессы (иначе restart "зависает" на 10s таймауте)
|
||||
init: true
|
||||
# Порт проброшен только на localhost — наружу сайт отдаёт nginx,
|
||||
# проксируя на http://127.0.0.1:3000
|
||||
ports:
|
||||
@@ -15,9 +18,16 @@ services:
|
||||
environment:
|
||||
# public runtimeConfig можно переопределять без пересборки образа
|
||||
- NUXT_PUBLIC_SITE_URL=https://na-granicelife.ru
|
||||
# Логи не должны заполнить диск: максимум 5 файлов по 10 МБ
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "5"
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:3000/"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 10s
|
||||
# SSR-серверу Nuxt нужно время на прогрев первого запроса
|
||||
start_period: 30s
|
||||
|
||||
Reference in New Issue
Block a user