Skip to content

Commit

Permalink
Add Docker workflow for publishing image and system setup
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesvien committed Dec 24, 2024
1 parent d14772c commit ed7cca4
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 6 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Docker

on:
push:
branches: [ "main" ]
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "main" ]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ git clone https://github.com/virattt/ai-hedge-fund.git
cd ai-hedge-fund
```

### System Requirements
- CPU: Any modern CPU (last 5 years)
- RAM: 2GB minimum, 4GB recommended
- Storage: 1GB free space
- Internet: Stable connection required
- No GPU required

The system is lightweight as it primarily manages workflows between APIs (OpenAI and financial data) without running any local AI models.

### Option 1: Local Setup

1. Install Poetry (if not already installed):
```bash
curl -sSL https://install.python-poetry.org | python3 -
Expand All @@ -64,6 +75,28 @@ export OPENAI_API_KEY='your-api-key-here' # Get a key from https://platform.open
export FINANCIAL_DATASETS_API_KEY='your-api-key-here' # Get a key from https://financialdatasets.ai/
```

### Option 2: Docker Setup

You can either build the image locally or use our official image from GitHub Container Registry:

#### Using the Official Image

1. Create and configure your `.env` file as explained above.

2. Pull and run the official image using docker compose:
```bash
# Run the trading agent
docker compose run agent --ticker AAPL

# Run the backtester
docker compose run backtester --ticker AAPL

# Run with custom parameters
docker compose run agent --ticker AAPL --start-date 2024-01-01 --end-date 2024-03-01 --show-reasoning
```

The Docker setup uses a lightweight Python 3.9 base image and installs only the required dependencies.

## Usage

### Running the Hedge Fund
Expand Down
8 changes: 2 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ version: '3.8'

services:
agent:
build:
context: .
dockerfile: Dockerfile
image: ghcr.io/virattt/ai-hedge-fund:main
env_file: .env
volumes:
- .:/app
Expand All @@ -14,9 +12,7 @@ services:
- ai-hedge-fund

backtester:
build:
context: .
dockerfile: Dockerfile
image: ghcr.io/virattt/ai-hedge-fund:main
env_file: .env
volumes:
- .:/app
Expand Down

0 comments on commit ed7cca4

Please sign in to comment.