Files
Fast-Whisper-MCP-Server/docker-run-api.sh
Alihan fb1e5dceba Upgrade to PyTorch 2.6.0 and enhance GPU reset script with Ollama management
- Upgrade PyTorch and torchaudio to 2.6.0 with CUDA 12.4 support
- Update GPU reset script to gracefully stop/start Ollama via supervisorctl
- Add Docker Compose configuration for both API and MCP server modes
- Implement comprehensive Docker entrypoint for multi-mode deployment
- Add GPU health check cleanup to prevent memory leaks
- Fix transcription memory management with proper resource cleanup
- Add filename security validation to prevent path traversal attacks
- Include .dockerignore for optimized Docker builds
- Remove deprecated supervisor configuration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 23:01:22 +03:00

63 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
set -e
datetime_prefix() {
date "+[%Y-%m-%d %H:%M:%S]"
}
echo "$(datetime_prefix) Starting Whisper Transcriptor in API mode with nginx..."
# Check if image exists
if ! docker image inspect transcriptor-apimcp:latest &> /dev/null; then
echo "$(datetime_prefix) Image not found. Building first..."
./docker-build.sh
fi
# Stop and remove existing container if running
if docker ps -a --format '{{.Names}}' | grep -q '^transcriptor-api$'; then
echo "$(datetime_prefix) Stopping existing container..."
docker stop transcriptor-api || true
docker rm transcriptor-api || true
fi
# Run the container in API mode
docker run -d \
--name transcriptor-api \
--gpus all \
-p 33767:80 \
-e SERVER_MODE=api \
-e API_HOST=127.0.0.1 \
-e API_PORT=33767 \
-e CUDA_VISIBLE_DEVICES=0 \
-e TRANSCRIPTION_MODEL=large-v3 \
-e TRANSCRIPTION_DEVICE=auto \
-e TRANSCRIPTION_COMPUTE_TYPE=auto \
-e JOB_QUEUE_MAX_SIZE=5 \
-v "$(pwd)/models:/models" \
-v "$(pwd)/outputs:/outputs" \
-v "$(pwd)/logs:/logs" \
--restart unless-stopped \
transcriptor-apimcp:latest
echo "$(datetime_prefix) Container started!"
echo ""
echo "API Server running at: http://localhost:33767"
echo ""
echo "Useful commands:"
echo " Check logs: docker logs -f transcriptor-api"
echo " Check status: docker ps | grep transcriptor-api"
echo " Test health: curl http://localhost:33767/health"
echo " Test GPU: curl http://localhost:33767/health/gpu"
echo " Stop container: docker stop transcriptor-api"
echo " Restart: docker restart transcriptor-api"
echo ""
echo "$(datetime_prefix) Waiting for service to start..."
sleep 5
# Test health endpoint
if curl -s http://localhost:33767/health > /dev/null 2>&1; then
echo "$(datetime_prefix) ✓ Service is healthy!"
else
echo "$(datetime_prefix) ⚠ Service not responding yet. Check logs with: docker logs transcriptor-api"
fi