Files
bolt-diy/docker-compose.yaml
Keoma Wright 56e602b7f4 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
2025-08-24 10:31:23 +00:00

97 lines
2.9 KiB
YAML

services:
app-prod:
image: bolt-ai:production
build:
context: .
dockerfile: Dockerfile
target: bolt-ai-production
ports:
- '5173:5173'
env_file:
- '.env'
- '.env.local'
environment:
- NODE_ENV=production
- COMPOSE_PROFILES=production
# No strictly needed but serving as hints for Coolify
- PORT=5173
- GROQ_API_KEY=${GROQ_API_KEY}
- HuggingFace_API_KEY=${HuggingFace_API_KEY}
- OPENAI_API_KEY=${OPENAI_API_KEY}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
- OPEN_ROUTER_API_KEY=${OPEN_ROUTER_API_KEY}
- GOOGLE_GENERATIVE_AI_API_KEY=${GOOGLE_GENERATIVE_AI_API_KEY}
- OLLAMA_API_BASE_URL=${OLLAMA_API_BASE_URL}
- XAI_API_KEY=${XAI_API_KEY}
- TOGETHER_API_KEY=${TOGETHER_API_KEY}
- TOGETHER_API_BASE_URL=${TOGETHER_API_BASE_URL}
- AWS_BEDROCK_CONFIG=${AWS_BEDROCK_CONFIG}
- VITE_LOG_LEVEL=${VITE_LOG_LEVEL:-debug}
- DEFAULT_NUM_CTX=${DEFAULT_NUM_CTX:-32768}
- RUNNING_IN_DOCKER=true
extra_hosts:
- 'host.docker.internal:host-gateway'
command: pnpm run dockerstart
profiles:
- production
app-dev:
image: bolt-ai:development
build:
target: bolt-ai-development
env_file:
- '.env'
- '.env.local'
environment:
- NODE_ENV=development
- VITE_HMR_PROTOCOL=ws
- VITE_HMR_HOST=localhost
- VITE_HMR_PORT=5173
- CHOKIDAR_USEPOLLING=true
- WATCHPACK_POLLING=true
- PORT=5173
- GROQ_API_KEY=${GROQ_API_KEY}
- HuggingFace_API_KEY=${HuggingFace_API_KEY}
- OPENAI_API_KEY=${OPENAI_API_KEY}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
- OPEN_ROUTER_API_KEY=${OPEN_ROUTER_API_KEY}
- XAI_API_KEY=${XAI_API_KEY}
- GOOGLE_GENERATIVE_AI_API_KEY=${GOOGLE_GENERATIVE_AI_API_KEY}
- OLLAMA_API_BASE_URL=${OLLAMA_API_BASE_URL}
- TOGETHER_API_KEY=${TOGETHER_API_KEY}
- TOGETHER_API_BASE_URL=${TOGETHER_API_BASE_URL}
- AWS_BEDROCK_CONFIG=${AWS_BEDROCK_CONFIG}
- VITE_LOG_LEVEL=${VITE_LOG_LEVEL:-debug}
- DEFAULT_NUM_CTX=${DEFAULT_NUM_CTX:-32768}
- RUNNING_IN_DOCKER=true
extra_hosts:
- 'host.docker.internal:host-gateway'
volumes:
- type: bind
source: .
target: /app
consistency: cached
- /app/node_modules
ports:
- '5173:5173'
command: pnpm run dev --host 0.0.0.0
profiles: ['development', 'default']
app-prebuild:
image: ghcr.io/stackblitz-labs/bolt.diy:latest
ports:
- '5173:5173'
environment:
- NODE_ENV=production
- COMPOSE_PROFILES=production
# No strictly needed but serving as hints for Coolify
- PORT=5173
- OLLAMA_API_BASE_URL=http://127.0.0.1:11434
- DEFAULT_NUM_CTX=${DEFAULT_NUM_CTX:-32768}
- RUNNING_IN_DOCKER=true
extra_hosts:
- 'host.docker.internal:host-gateway'
command: pnpm run dockerstart
profiles:
- prebuilt