Skip to content

Added Docker files #219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM python:3.10-slim
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe use the latest python version 3.14

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3.12-slim is the latest stable release, I have adjusted this accordingly.


# Install system dependencies
RUN apt-get update && apt-get install -y \
curl build-essential git libffi-dev \
&& apt-get clean

# Install poetry
ENV POETRY_VERSION=1.8.2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the latest peotry version 2.1.0

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version 1.8.5 ist the latest version working with the app, I adjusted it to 1.8.5

RUN curl -sSL https://install.python-poetry.org | python3 - \
&& ln -s /root/.local/bin/poetry /usr/local/bin/poetry

# Set working directory
WORKDIR /app

# Copy project files
COPY pyproject.toml poetry.lock* ./
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line could be replaces by shifting line 22 to this position.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, makes sense

RUN poetry config virtualenvs.create false \
&& poetry install --no-interaction --no-ansi

# Copy the rest of the application code
COPY . .

# Entry point
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not the entrypoint, it is the default command which will be executed when container starts. For Entrypoint use the ENTRYPOINT instruction. -> https://docs.docker.com/reference/dockerfile/

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, will adjust it

CMD ["poetry", "run", "python", "src/main.py", "--ticker", "AAPL,MSFT,NVDA", "--show-reasoning"]
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,16 @@ You can optionally specify the start and end dates to backtest over a specific t
poetry run python src/backtester.py --ticker AAPL,MSFT,NVDA --start-date 2024-01-01 --end-date 2024-03-01
```

## Running in Docker
```bash
docker build -t ai-hedge-fund .
docker-compose build --no-cache
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It isn't necessary to use compose to build the image.

docker build -t ai-hedge-fund

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I adjusted the part for building/running

docker-compose run --rm ai-hedge-fund
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docker compose is a plugin of docker you have to use the command as followed.
and it possible to run it detached.

docker compose up -d

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I adjusted the part for building/running

```

**Important**: Adjust the parameters in the Dockerfile as needed, particularly the final section that defines the entry point.


## Project Structure
```
ai-hedge-fund/
Expand Down
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: "3.9"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the version element isn't needed in the latest version of docker compose

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

services:
ai-hedge-fund:
build: .
container_name: ai-hedge-fund
env_file: .env
stdin_open: true
tty: true
volumes:
- .:/app