-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Dockerized version #152
base: main
Are you sure you want to change the base?
Dockerized version #152
Conversation
|
||
# Set default command with -u flag for unbuffered output | ||
ENTRYPOINT ["poetry", "run", "python", "-u", "src/main.py"] | ||
CMD ["--ticker", "AAPL,MSFT,NVDA"] # Optional default arguments |
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.
Please add a new line at end of file.
@@ -0,0 +1,34 @@ | |||
# Use Python 3.10 slim image as base | |||
FROM python:3.10-slim |
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.
May change it to python 3.13. Python 3.10 will be end of life next year.
@@ -126,6 +126,18 @@ 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 | |||
``` | |||
|
|||
## Using Docker | |||
|
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.
Add the info to create a .env file first.
# Copy source code | ||
COPY src/ src/ | ||
COPY .env . | ||
COPY .gitignore . |
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.
Not needed
COPY src/ src/ | ||
COPY .env . | ||
COPY .gitignore . | ||
COPY README.md . |
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.
Not needed
COPY .env . | ||
COPY .gitignore . | ||
COPY README.md . | ||
COPY LICENSE . |
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.
Not needed
RUN apt-get update && apt-get install -y \ | ||
gcc \ | ||
python3-dev \ | ||
curl \ |
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.
Not needed when you use "pip install poetry"
curl \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN curl -sSL https://install.python-poetry.org | python3 - |
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.
Use "pip install poetry" to get rid of curl
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN curl -sSL https://install.python-poetry.org | python3 - | ||
ENV PATH="/root/.local/bin:$PATH" |
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.
You can combine this with line 30 to remove this docker layer:
ENV PYTHONUNBUFFERED=1
PATH="/root/.local/bin:$PATH"
I think this PR can be closed as PR #154 contains the Dockerfile. |
Created a Dockerfile which creates a reproducible container.
Also updated README w/ instructions.