Files
tg_tinder_bot/bin/fix_docker.bat
2025-09-18 16:47:07 +09:00

101 lines
3.0 KiB
Batchfile
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.

@echo off
REM fix_docker.bat - Скрипт для устранения проблемы ContainerConfig в Windows
echo 🔧 Устранение проблемы с Docker контейнерами...
REM Остановка всех контейнеров проекта
echo 📥 Остановка всех контейнеров проекта...
docker-compose down -v
REM Принудительное удаление контейнеров по имени
echo 🗑️ Принудительное удаление оставшихся контейнеров...
docker rm -f postgres-tinder adminer-tinder telegram-tinder-bot 2>NUL
REM Очистка неиспользуемых томов и сетей
echo 🧹 Очистка неиспользуемых томов и сетей...
docker system prune -f --volumes
REM Очистка кеша Docker
echo 🧼 Очистка кеша Docker...
docker builder prune -f
REM Исправление docker-compose.yml
echo 📝 Создание обновленного docker-compose.yml...
REM Создаем обновленный docker-compose.yml с использованием PowerShell
powershell -Command "& {
$content = @'
version: '3.8'
services:
bot:
build: .
container_name: telegram-tinder-bot
restart: unless-stopped
env_file: .env
environment:
- NODE_ENV=production
- DB_HOST=${DB_HOST:-db}
- DB_PORT=${DB_PORT:-5432}
- DB_NAME=${DB_NAME:-telegram_tinder_bot}
- DB_USERNAME=${DB_USERNAME:-postgres}
- DB_PASSWORD=${DB_PASSWORD:-postgres}
volumes:
- ./uploads:/app/uploads:rw
- ./logs:/app/logs:rw
networks:
- bot-network
healthcheck:
test: [\"CMD\", \"wget\", \"--no-verbose\", \"--tries=1\", \"--spider\", \"http://localhost:3000/health\"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
db:
image: postgres:15-alpine
container_name: postgres-tinder
restart: unless-stopped
environment:
- POSTGRES_DB=${DB_NAME:-telegram_tinder_bot}
- POSTGRES_USER=${DB_USERNAME:-postgres}
- POSTGRES_PASSWORD=${DB_PASSWORD:-postgres}
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- \"5433:5432\"
networks:
- bot-network
healthcheck:
test: [\"CMD-SHELL\", \"pg_isready -U ${DB_USERNAME:-postgres} -d ${DB_NAME:-telegram_tinder_bot}\"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
adminer:
image: adminer:latest
container_name: adminer-tinder
restart: unless-stopped
ports:
- \"8080:8080\"
networks:
- bot-network
volumes:
postgres_data:
networks:
bot-network:
driver: bridge
'@
Set-Content -Path 'docker-compose.yml' -Value $content
}"
echo ✅ docker-compose.yml обновлен!
echo 🚀 Готово! Теперь вы можете запустить контейнеры снова с помощью команды:
echo docker-compose up -d
pause