diff options
| author | Grail Finder <wohilas@gmail.com> | 2025-12-06 13:10:08 +0300 |
|---|---|---|
| committer | Grail Finder <wohilas@gmail.com> | 2025-12-07 13:22:07 +0300 |
| commit | ecd7fdee551cb43d17a79bea1f76cc263598d58c (patch) | |
| tree | 5ea6164f057506ec6732602237d0448fa1e04f5c | |
| parent | 0f3baa4f8b2e158e446ba93d83b1b9c19a96bb1d (diff) | |
Feat: dockerfiles
| -rw-r--r-- | Makefile | 46 | ||||
| -rw-r--r-- | docker-compose.yml | 41 |
2 files changed, 86 insertions, 1 deletions
@@ -1,4 +1,4 @@ -.PHONY: setconfig run lint +.PHONY: setconfig run lint setup-whisper build-whisper download-whisper-model docker-up docker-down docker-logs run: setconfig go build -o gf-lt && ./gf-lt @@ -11,3 +11,47 @@ setconfig: lint: ## Run linters. Use make install-linters first. golangci-lint run -c .golangci.yml ./... + +# Whisper STT Setup +setup-whisper: build-whisper download-whisper-model + +build-whisper: ## Build whisper.cpp from source + @echo "Building whisper.cpp from source..." + @if [ ! -d "whisper.cpp" ]; then \ + echo "Cloning whisper.cpp repository..."; \ + git clone https://github.com/ggml-org/whisper.cpp.git; \ + fi + cd whisper.cpp && make build + @echo "Creating symlink to whisper-cli binary..." + @ln -sf whisper.cpp/build/bin/whisper-cli ./whisper-cli + @echo "Whisper binary built successfully!" + +download-whisper-model: ## Download Whisper model for STT + @echo "Downloading Whisper model for STT..." + @if [ ! -d "whisper.cpp" ]; then \ + echo "Please run 'make setup-whisper' first to clone the repository."; \ + exit 1; \ + fi + @cd whisper.cpp && make tiny.en + @echo "Creating symlink to Whisper model..." + @ln -sf whisper.cpp/models/ggml-tiny.en.bin ./ggml-model.bin + @echo "Whisper model downloaded successfully!" + +# Docker targets for STT/TTS services +docker-up: ## Start Docker Compose services for STT and TTS + @echo "Starting Docker services for STT (whisper) and TTS (kokoro)..." + docker-compose up -d + @echo "Docker services started. STT available at http://localhost:8081, TTS available at http://localhost:8880" + +docker-down: ## Stop Docker Compose services + @echo "Stopping Docker services..." + docker-compose down + @echo "Docker services stopped" + +docker-logs: ## View logs from Docker services + @echo "Displaying logs from Docker services..." + docker-compose logs -f + +# Convenience target to setup everything +setup-complete: setup-whisper docker-up + @echo "Complete setup finished! STT and TTS services are running." diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..81a6d9d --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,41 @@ +services: + # Whisper.cpp STT service + whisper: + image: ghcr.io/ggml-org/whisper.cpp:main + container_name: whisper-stt + ports: + - "8081:8081" + volumes: + - ./models:/app/models + - ./audio:/app/audio + working_dir: /app + entrypoint: "" + command: ["./build/bin/whisper-server", "-m", "/app/models/ggml-tiny.en.bin", "-t", "4", "-p", "1", "--port", "8081", "--host", "0.0.0.0"] + environment: + - WHISPER_LOG_LEVEL=3 + # Restart policy in case the service fails + restart: unless-stopped + + # Kokoro-FastAPI TTS service + kokoro-tts: + image: ghcr.io/remsky/kokoro-fastapi-cpu:latest + container_name: kokoro-tts + ports: + - "8880:8880" + environment: + - API_LOG_LEVEL=INFO + # For GPU support, uncomment the following lines: + # deploy: + # resources: + # reservations: + # devices: + # - driver: nvidia + # count: 1 + # capabilities: [gpu] + restart: unless-stopped + +volumes: + models: + driver: local + audio: + driver: local
\ No newline at end of file |
