fix: resolve .env.local not loading in docker compose

Fixes issue #1827 where Docker Compose wasn't properly loading .env.local file.

Problem:
- Docker Compose expects .env file for variable substitution but docs say to use .env.local
- This caused environment variables to not be loaded in Docker containers

Solution:
- Updated docker-compose.yaml to load both .env and .env.local files
- Created setup-env.sh script to help users sync .env.local to .env
- Updated documentation with clear instructions for Docker users
- Maintains backward compatibility with existing setups

Changes:
- Modified docker-compose.yaml to use array syntax for env_file
- Added scripts/setup-env.sh helper script
- Updated CONTRIBUTING.md and index.md documentation

This ensures environment variables work correctly in Docker while maintaining
the security best practice of using .env.local for sensitive data.

Contributed by: Keoma Wright
This commit is contained in:
Keoma Wright
2025-08-24 10:31:23 +00:00
parent bab9a64ab6
commit 56e602b7f4
4 changed files with 63 additions and 5 deletions

View File

@@ -95,11 +95,20 @@ Interested in maintaining and growing the project? Fill out our [Contributor App
OPENAI_API_KEY=XXX
...
```
3. Optionally set:
3. **For Docker users**: Run the setup script or manually copy `.env.local` to `.env`:
```bash
# Option 1: Use the setup script
./scripts/setup-env.sh
# Option 2: Manual copy
cp .env.local .env
```
Docker Compose requires `.env` for variable substitution.
4. Optionally set:
- Debug level: `VITE_LOG_LEVEL=debug`
- Context size: `DEFAULT_NUM_CTX=32768`
**Note**: Never commit your `.env.local` file to version control. Its already in `.gitignore`.
**Note**: Never commit your `.env.local` or `.env` files to version control. They're already in `.gitignore`.
### 2⃣ Run Development Server

View File

@@ -99,7 +99,11 @@ ANTHROPIC_API_KEY=XXX
Once you've set your keys, you can proceed with running the app. You will set these keys up during the initial setup, and you can revisit and update them later after the app is running.
**Note**: Never commit your `.env.local` file to version control. Its already included in the `.gitignore`.
**Important for Docker users**: Docker Compose needs a `.env` file for variable substitution. After creating `.env.local`:
- Run `./scripts/setup-env.sh` to automatically sync the files, or
- Manually copy: `cp .env.local .env`
**Note**: Never commit your `.env.local` or `.env` files to version control. They're already included in the `.gitignore`.
#### 2. Configure API Keys Directly in the Application