Skip to content

Commit

Permalink
Refactor Docker setup: streamline build arguments, update image name,…
Browse files Browse the repository at this point in the history
… and enhance documentation for environment configuration
  • Loading branch information
Zochory committed Feb 2, 2025
1 parent 9e3c2f3 commit a0f1117
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 36 deletions.
43 changes: 10 additions & 33 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,7 @@
FROM python:3.12-slim

# Build arguments for all configurable values
# Build argument for version only
ARG VERSION=0.4.71
# Azure OpenAI
ARG AZURE_OPENAI_API_KEY
ARG AZURE_OPENAI_ENDPOINT
ARG AZURE_OPENAI_DEPLOYMENT
ARG AZURE_OPENAI_MODEL
# OAuth
ARG USE_OAUTH=true
ARG OAUTH_GITHUB_CLIENT_ID
ARG OAUTH_GITHUB_CLIENT_SECRET
# Other APIs
ARG OPENAI_API_KEY
ARG GEMINI_API_KEY
ARG DEEPSEEK_API_KEY
ARG COGCACHE_API_KEY
ARG RUN_MODE=default

# Set build arguments as environment variables
ENV VERSION=${VERSION}
ENV AZURE_OPENAI_API_KEY=${AZURE_OPENAI_API_KEY}
ENV AZURE_OPENAI_ENDPOINT=${AZURE_OPENAI_ENDPOINT}
ENV AZURE_OPENAI_DEPLOYMENT=${AZURE_OPENAI_DEPLOYMENT}
ENV AZURE_OPENAI_MODEL=${AZURE_OPENAI_MODEL}
ENV USE_OAUTH=${USE_OAUTH}
ENV OAUTH_GITHUB_CLIENT_ID=${OAUTH_GITHUB_CLIENT_ID}
ENV OAUTH_GITHUB_CLIENT_SECRET=${OAUTH_GITHUB_CLIENT_SECRET}
ENV OPENAI_API_KEY=${OPENAI_API_KEY}
ENV GEMINI_API_KEY=${GEMINI_API_KEY}
ENV DEEPSEEK_API_KEY=${DEEPSEEK_API_KEY}
ENV COGCACHE_API_KEY=${COGCACHE_API_KEY}

# Install system dependencies
RUN apt-get update && apt-get install -y \
Expand Down Expand Up @@ -60,14 +31,20 @@ RUN npx playwright install-deps && \
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/workspace
ENV PORT=8001
ENV VERSION=${VERSION}

# Default values for optional settings
ENV USE_OAUTH=false
ENV CHAINLIT_HOST=localhost
ENV CHAINLIT_PORT=8001

# Expose port
EXPOSE 8001

# Set entrypoint script
# Copy entrypoint script
COPY scripts/docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
ENTRYPOINT ["docker-entrypoint.sh"]

# Default command (can be overridden)
CMD ["sh", "-c", "agenticfleet start ${RUN_MODE:+no-oauth}"]
# Default command
CMD ["agenticfleet", "start"]
62 changes: 62 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,18 +167,21 @@ async def test_model(client):
### Option 1: Direct Installation

1. Install using uv (recommended):

```bash
uv pip install agentic-fleet
playwright install --with-deps chromium # Optional: Install Playwright
```

2. Configure environment:

```bash
cp .env.example .env
# Edit .env with your API keys
```

3. Start the server:

```bash
agenticfleet start # With OAuth
agenticfleet start no-oauth # Without OAuth
Expand All @@ -187,13 +190,15 @@ agenticfleet start no-oauth # Without OAuth
### Option 2: Docker Setup

1. Clone and configure:

```bash
git clone https://github.com/qredence/agenticfleet.git
cd agenticfleet
cp .env.example .env # Configure your .env file
```

2. Build and run with Docker Compose:

```bash
# Build the image
docker compose build
Expand All @@ -210,13 +215,15 @@ docker compose run -e RUN_MODE=no-oauth agenticfleet
You can provide environment variables in several ways:

1. Using a .env file:

```bash
cp .env.example .env
# Edit .env with your values
docker compose up
```

2. Using command line arguments:

```bash
docker compose build \
--build-arg AZURE_OPENAI_API_KEY=your_key \
Expand All @@ -225,13 +232,15 @@ docker compose build \
```

3. Using environment variables:

```bash
export AZURE_OPENAI_API_KEY=your_key
export AZURE_OPENAI_ENDPOINT=your_endpoint
docker compose up
```

4. For production deployments:

```bash
docker run -d \
-e AZURE_OPENAI_API_KEY=your_key \
Expand All @@ -242,6 +251,7 @@ docker run -d \
```

Key features of the Docker setup:

- Python 3.12 environment
- Automatic dependency installation
- Volume mounting for live development
Expand All @@ -254,22 +264,72 @@ Key features of the Docker setup:
For VS Code users with the Dev Containers extension:

1. Open in VS Code:

```bash
code agenticfleet
```

2. Press F1 and select "Dev Containers: Open Folder in Container"

The dev container provides:

- Full Python 3.12 development environment
- Pre-configured VS Code extensions
- Integrated debugging
- Live reload capability
- All dependencies pre-installed

### Quick Start with Docker

```bash
# Pull the latest image
docker pull qredenceai/agenticfleet:latest

# Run with minimum required configuration
docker run -d \
-p 8001:8001 \
-e AZURE_OPENAI_API_KEY=your_key \
-e AZURE_OPENAI_ENDPOINT=your_endpoint \
qredenceai/agenticfleet:latest

# Or run with additional configuration
docker run -d \
-p 8001:8001 \
-e AZURE_OPENAI_API_KEY=your_key \
-e AZURE_OPENAI_ENDPOINT=your_endpoint \
-e AZURE_OPENAI_DEPLOYMENT=your_deployment \
-e AZURE_OPENAI_MODEL=your_model \
-e USE_OAUTH=true \
-e OAUTH_GITHUB_CLIENT_ID=your_client_id \
-e OAUTH_GITHUB_CLIENT_SECRET=your_client_secret \
qredenceai/agenticfleet:latest

# Run without OAuth
docker run -d \
-p 8001:8001 \
-e AZURE_OPENAI_API_KEY=your_key \
-e AZURE_OPENAI_ENDPOINT=your_endpoint \
-e USE_OAUTH=false \
qredenceai/agenticfleet:latest
```

Required environment variables:

- `AZURE_OPENAI_API_KEY`: Your Azure OpenAI API key
- `AZURE_OPENAI_ENDPOINT`: Your Azure OpenAI endpoint

Optional environment variables:

- `USE_OAUTH`: Enable/disable OAuth (default: false)
- `OAUTH_GITHUB_CLIENT_ID`: GitHub OAuth client ID
- `OAUTH_GITHUB_CLIENT_SECRET`: GitHub OAuth client secret
- `CHAINLIT_AUTH_SECRET`: Custom auth secret for sessions
- Other API keys (GEMINI_API_KEY, DEEPSEEK_API_KEY, etc.)

### Environment Configuration

Required variables in `.env`:

```env
# Core Configuration
AZURE_OPENAI_API_KEY=your_api_key
Expand Down Expand Up @@ -390,3 +450,5 @@ This project is licensed under the Apache-2.0 License - see the [LICENSE](LICENS
## Star History

[![Star History Chart](https://api.star-history.com/svg?repos=Qredence/AgenticFleet&type=Date)](https://star-history.com/#Qredence/AgenticFleet&Date)

````
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:
DEEPSEEK_API_KEY: ${DEEPSEEK_API_KEY}
COGCACHE_API_KEY: ${COGCACHE_API_KEY}

image: qredence/agenticfleet:${TAG:-latest}
image: qredenceai/agenticfleet:${TAG:-latest} # Updated Docker Hub username
container_name: agenticfleet

env_file:
Expand All @@ -32,7 +32,7 @@ services:
- PORT=8001
- RUN_MODE=${RUN_MODE:-default}
- USE_OAUTH=true
- CHAINLIT_HOST=0.0.0.0
- CHAINLIT_HOST=localhost
- CHAINLIT_PORT=8001
- CHAINLIT_AUTH_SECRET=${CHAINLIT_AUTH_SECRET:-password}

Expand Down
2 changes: 1 addition & 1 deletion scripts/docker-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e

# Get version from pyproject.toml
VERSION=$(grep '^version = ' pyproject.toml | cut -d'"' -f2 | tr -d '\n')
IMAGE_NAME="qredence/agenticfleet"
IMAGE_NAME="qredenceai/agenticfleet" # Updated Docker Hub username
BRANCH=$(git rev-parse --abbrev-ref HEAD)

echo "Building AgenticFleet Docker image"
Expand Down

0 comments on commit a0f1117

Please sign in to comment.