Skip to content

Commit

Permalink
Merge pull request #99 from Qredence/0.4.9-release
Browse files Browse the repository at this point in the history
0.4.9 release
  • Loading branch information
Zochory authored Feb 25, 2025
2 parents d4af597 + 814bac8 commit 89f5bd1
Show file tree
Hide file tree
Showing 15 changed files with 1,221 additions and 456 deletions.
45 changes: 34 additions & 11 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,33 +1,56 @@
# Version control
.git/
.gitignore
.github/

# Environment and configuration
.env
.env.*
.venv/
venv/
env/
.python-version

# Python cache files
__pycache__/
*.pyc
*.pyo
*.pyd
.Python
*.so
.pytest_cache/
.ruff_cache/
.mypy_cache/
.coverage
htmlcov/

# Build artifacts
dist/
build/
*.egg
*.egg-info/
.coverage
htmlcov/
.pytest_cache/
.ruff_cache/
.mypy_cache/
node_modules/
*.whl

# Development tools
.vscode/
.idea/
*.swp
*.swo
.DS_Store
# Exclude sensitive files and directories
node_modules/

# Project-specific exclusions
secrets/
credentials/
private/
# Exclude tests
tests/
# Exclude documentation
docs/
# Exclude local logs
logs/
# Exclude local workspace
files/
workspace/
notebooks/

# Docker-specific
.dockerignore
docker-compose*.yml
docker-compose*.yaml
107 changes: 43 additions & 64 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,85 +1,64 @@
# Use the official Python image as the base
FROM mcr.microsoft.com/devcontainers/python:1-3.12-bullseye
# This is a symlink to the production Dockerfile
# For development, use docker-compose with the dev service
# For production, use docker-compose with the prod service
# For more information, see the README.md file

# Set the working directory inside the container
# Production Dockerfile for AgenticFleet
FROM python:3.12-slim

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PYTHONPATH=/app/src

# Set the working directory
WORKDIR /app

# Copy the requirements file into the container
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
curl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Copy requirements file
COPY requirements.txt .

# Install the dependencies
# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Install playwright dependencies
RUN python -m playwright install-deps
RUN pip install playwright && python -m playwright install-deps

# Copy the project files into the container
# Copy the project files
COPY . .

# Expose the port Chainlit runs on (default is 8000)
# Install the package
RUN pip install .

# Expose the port Chainlit runs on
EXPOSE 8000

# Set environment variables (using ARG for build-time flexibility, with defaults)
# Set environment variables (using ARG for build-time flexibility)
ARG OPENAI_API_KEY=""
ARG AZURE_OPENAI_ENDPOINT=""
ARG AZURE_OPENAI_API_KEY=""
ARG AZURE_OPENAI_DEPLOYMENT=""
ARG AZURE_OPENAI_MODEL=""
ARG AZURE_OPENAI_API_VERSION=""
ARG USE_OAUTH=""
ARG OAUTH_PROVIDER=""
ARG OAUTH_PROMPT=""
ARG OAUTH_GITHUB_CLIENT_ID=""
ARG OAUTH_GITHUB_CLIENT_SECRET=""
ARG OAUTH_REDIRECT_URI=""

# Azure OpenAI Configuration
ARG AZURE_AI_PHI_MODEL=""
ARG AZURE_AI_DEEPSEEK_R1_MODEL=""
ARG AZURE_AI_FOUNDRY_MODEL=""
ARG AZURE_AI_FOUNDRY_API_VERSION=""
ARG AZURE_AI_FOUNDRY_API_KEY=""
ARG POOL_MANAGEMENT_ENDPOINT=""
ARG GITHUB_TOKEN=""
ARG DB_USER=""
ARG DB_PASSWORD=""
ARG DB_HOST=""
ARG DB_PORT=""
ARG DB_NAME=""
ARG GITHUB_CLIENT_ID=""
ARG GITHUB_CLIENT_SECRET=""
ARG GOOGLE_CLIENT_ID=""
ARG GOOGLE_CLIENT_SECRET=""

# Set environment variables
ENV OPENAI_API_KEY=${OPENAI_API_KEY} \
AZURE_OPENAI_ENDPOINT=${AZURE_OPENAI_ENDPOINT} \
AZURE_OPENAI_API_KEY=${AZURE_OPENAI_API_KEY} \
AZURE_OPENAI_API_VERSION=${AZURE_OPENAI_API_VERSION} \
USE_OAUTH=${USE_OAUTH}

ENV OPENAI_API_KEY=${OPENAI_API_KEY}
ENV AZURE_OPENAI_ENDPOINT=${AZURE_OPENAI_ENDPOINT}
ENV AZURE_OPENAI_API_KEY=${AZURE_OPENAI_API_KEY}
ENV AZURE_OPENAI_DEPLOYMENT=${AZURE_OPENAI_DEPLOYMENT}
ENV AZURE_OPENAI_MODEL=${AZURE_OPENAI_MODEL}
ENV AZURE_OPENAI_API_VERSION=${AZURE_OPENAI_API_VERSION}
ENV USE_OAUTH=${USE_OAUTH}
ENV OAUTH_PROVIDER=${OAUTH_PROVIDER}
ENV OAUTH_PROMPT=${OAUTH_PROMPT}
ENV OAUTH_GITHUB_CLIENT_ID=${OAUTH_GITHUB_CLIENT_ID}
ENV OAUTH_GITHUB_CLIENT_SECRET=${OAUTH_GITHUB_CLIENT_SECRET}
ENV OAUTH_REDIRECT_URI=${OAUTH_REDIRECT_URI}
ENV AZURE_AI_PHI_MODEL=${AZURE_AI_PHI_MODEL}
ENV AZURE_AI_DEEPSEEK_R1_MODEL=${AZURE_AI_DEEPSEEK_R1_MODEL}
ENV AZURE_AI_FOUNDRY_MODEL=${AZURE_AI_FOUNDRY_MODEL}
ENV AZURE_AI_FOUNDRY_API_VERSION=${AZURE_AI_FOUNDRY_API_VERSION}
ENV AZURE_AI_FOUNDRY_API_KEY=${AZURE_AI_FOUNDRY_API_KEY}
ENV POOL_MANAGEMENT_ENDPOINT=${POOL_MANAGEMENT_ENDPOINT}
ENV GITHUB_TOKEN=${GITHUB_TOKEN}
ENV DB_USER=${DB_USER}
ENV DB_PASSWORD=${DB_PASSWORD}
ENV DB_HOST=${DB_HOST}
ENV DB_PORT=${DB_PORT}
ENV DB_NAME=${DB_NAME}
ENV GITHUB_CLIENT_ID=${GITHUB_CLIENT_ID}
ENV GITHUB_CLIENT_SECRET=${GITHUB_CLIENT_SECRET}
ENV GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID}
ENV GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET}
# Copy and set the entrypoint script
COPY scripts/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]

# Run the Chainlit application
CMD ["chainlit", "run", "src/agentic_fleet/app.py"]
# Set the default command to run the Chainlit application
CMD ["chainlit", "run", "src/agentic_fleet/app.py", "--host", "0.0.0.0", "--port", "8000"]
47 changes: 47 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
version: '3.8'

services:
# Base image for development and production
base:
build:
context: .
dockerfile: docker/base.Dockerfile
image: qredenceai/agenticfleet-base:latest
profiles:
- build-only

# Development environment
dev:
build:
context: .
dockerfile: docker/dev.Dockerfile
image: qredenceai/agenticfleet-dev:latest
volumes:
- .:/app
- ./logs:/app/logs
ports:
- "8000:8000"
env_file:
- .env
environment:
- DEBUG=true
- LOG_LEVEL=DEBUG
depends_on:
- base
command: chainlit run src/agentic_fleet/app.py --host 0.0.0.0 --port 8000

# Production environment
prod:
build:
context: .
dockerfile: docker/prod.Dockerfile
image: qredenceai/agenticfleet:latest
ports:
- "8000:8000"
env_file:
- .env
environment:
- DEBUG=false
- LOG_LEVEL=INFO
restart: unless-stopped
command: chainlit run src/agentic_fleet/app.py --host 0.0.0.0 --port 8000
76 changes: 76 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Docker Setup for AgenticFleet

This directory contains the Docker configuration for AgenticFleet, providing a modular and flexible approach to containerization.

## Docker Files Structure

- `base.Dockerfile`: Base image with core dependencies
- `dev.Dockerfile`: Development environment with additional tools and live-reload
- `prod.Dockerfile`: Production-optimized image

## Quick Start

### Development Environment

```bash
# Build and start the development environment
docker-compose up -d dev

# View logs
docker-compose logs -f dev
```

### Production Environment

```bash
# Build and start the production environment
docker-compose up -d prod

# View logs
docker-compose logs -f prod
```

## Manual Building

You can also build the Docker images manually using the provided script:

```bash
# Build the base image
./scripts/docker-build.sh base

# Build the development image
./scripts/docker-build.sh dev

# Build the production image
./scripts/docker-build.sh prod

# Build and push the production image to Docker Hub
./scripts/docker-build.sh prod --push
```

## Environment Variables

The Docker containers require certain environment variables to function properly. You can provide these variables in a `.env` file in the project root or pass them directly to the container.

Required environment variables:

- `AZURE_OPENAI_ENDPOINT`: Azure OpenAI API endpoint
- `AZURE_OPENAI_API_KEY`: Azure OpenAI API key
- `AZURE_OPENAI_API_VERSION`: Azure OpenAI API version

See `.env.example` for a complete list of supported environment variables.

## Volumes

The development environment mounts the following volumes:

- `.:/app`: The project root directory for live code changes
- `./logs:/app/logs`: Logs directory for persistent logs

## Ports

Both development and production environments expose port 8000, which can be accessed at `http://localhost:8000`.

## Customization

You can customize the Docker setup by modifying the `docker-compose.yml` file or the individual Dockerfiles in the `docker` directory.
27 changes: 27 additions & 0 deletions docker/base.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Base Dockerfile for AgenticFleet
FROM mcr.microsoft.com/devcontainers/python:1-3.12-bullseye

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PYTHONPATH=/app/src

# Set the working directory
WORKDIR /app

# Copy requirements file
COPY requirements.txt .

# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Install playwright dependencies
RUN python -m playwright install-deps

# Copy the project files
COPY . .

# Install the package in development mode
RUN pip install -e .
15 changes: 15 additions & 0 deletions docker/dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Development Dockerfile for AgenticFleet
FROM qredenceai/agenticfleet-base:latest

# Install development dependencies
RUN pip install --no-cache-dir ".[dev,test]"

# Set environment variables for development
ENV DEBUG=true \
LOG_LEVEL=DEBUG

# Expose the port Chainlit runs on
EXPOSE 8000

# Set the default command to run the Chainlit application in development mode
CMD ["chainlit", "run", "src/agentic_fleet/app.py", "--host", "0.0.0.0", "--port", "8000"]
Loading

0 comments on commit 89f5bd1

Please sign in to comment.