-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Added Docker files #219
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
FROM python:3.10-slim | ||
|
||
# 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use the latest peotry version 2.1.0 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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* ./ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this line could be replaces by shifting line 22 to this position. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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/ There was a problem hiding this comment. Choose a reason for hiding this commentThe 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"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It isn't necessary to use compose to build the image.
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: "3.9" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.