Infinity_Doc / docker_instructions.md
shahriarabir's picture
version 1.0.0
c3cba0a
|
Raw History Blame Contribute Delete
3.96 kB
# Infinity Doctor Docker Instructions
This document provides detailed instructions on how to build and run the Infinity Doctor application using Docker.
## Prerequisites
- Install Docker Desktop for Windows from [https://www.docker.com/products/docker-desktop](https://www.docker.com/products/docker-desktop)
- Ensure Docker is running on your system
- API keys for Groq (and optionally ElevenLabs)
## Setting Up Environment Variables
1. Create a `.env` file in your project directory:
```
# Copy the example file
Copy-Item .env.example .env
# Edit the file with your preferred editor
notepad .env
```
2. Add your API keys to the `.env` file:
```
GROQ_API_KEY=your_groq_api_key_here
ELEVENLABS_API_KEY=your_elevenlabs_api_key_here
```
## Building and Running with Docker
### Option 1: Using the PowerShell script (Recommended for Windows)
1. Open PowerShell and navigate to the project directory
2. Run the provided script:
```
.\run_docker.ps1
```
This script will:
- Check for a `.env` file and create one if it doesn't exist
- Create necessary directories for data persistence
- Build the Docker image
- Run the container with all required parameters
### Option 2: Using Docker Compose
1. Run the application with Docker Compose:
```
docker-compose up
```
This will:
- Build the Docker image if it doesn't exist
- Run the container with mounted volumes for data persistence
- Inject environment variables from your `.env` file
- Map port 7860 to your host machine
2. To stop the application:
```
docker-compose down
```
3. To rebuild the image and start fresh:
```
docker-compose up --build
```
### Option 3: Using Docker commands directly
1. Build the Docker image:
```
docker build -t infinity-doctor .
```
2. Run the Docker container with environment variables:
```
docker run --rm -p 7860:7860 --env-file .env -v ${PWD}/images:/app/images -v ${PWD}/audio_data:/app/audio_data infinity-doctor
```
## Data Persistence
The Docker configuration is set up to persist data in two directories:
1. `./images`: For storing uploaded images
2. `./audio_data`: For storing audio recordings and generated audio responses
These directories are mounted as volumes in the Docker container, so your data will persist between container restarts.
## Accessing the Application
Once running, access the Infinity Doctor application at:
[http://localhost:7860](http://localhost:7860)
## Notes
- The Docker container exposes port 7860, which is the default port for Gradio applications
- Images uploaded through the interface will be saved in the `images` directory
- Audio files are processed within the container
## GPU Support (Optional)
If you have a compatible NVIDIA GPU and want to use it for faster processing:
1. Install [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html)
2. Add the `--gpus all` flag when running the container:
```
docker run --rm --gpus all -p 7860:7860 --env-file .env -v ${PWD}/images:/app/images -v ${PWD}/audio_data:/app/audio_data infinity-doctor
```
3. Or modify the docker-compose.yml file to add:
```yaml
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
```
## Troubleshooting
- If you encounter issues with audio devices, note that Docker containers do not have direct access to the host's microphone. Use the text input option or upload pre-recorded audio files.
- If you get a "port already in use" error, change the port mapping in the docker run command:
```
docker run --rm -p 7861:7860 --env-file .env infinity-doctor
```
Then access the application at http://localhost:7861
- For permission errors with mounted volumes, ensure the user running Docker has write access to the directories.