-
Notifications
You must be signed in to change notification settings - Fork 263
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
Feature - Dockerfile Update to Install Python-Modules from local_requirements.txt
#109
Conversation
@@ -42,4 +42,8 @@ COPY . /opt/nautobot | |||
|
|||
RUN poetry install | |||
|
|||
# Install additional requirements from local_requirements.txt | |||
RUN if [ -f local_requirements.txt ] ; then cat local_requirements.txt | grep -E '^[^# ]' | cut -d= -f1 | xargs -n 1 poetry add ; fi |
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.
Huh, this is kind of clever, but not sure what this buys us in a container compared to just running if [ -f local_requirements.txt ] ; then pip install -r local_requirements.txt; fi
.
Thoughts?
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.
It at least has the small advantage that it stays within the Poetry tool chain instead of mixing Poetry and Pip. I'd want to test this to make sure it doesn't end up modifying the pyproject.toml/poetry.lock in Git, though?
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.
@glennmatthews Yeah that was my concern, too, I think. I just didn't spell it out. Pretty sure it would update them which might result in breaking layer caching.
I dont think that there can be a changes in source directory during a docker build because no volumes are mounted and the source directory will be copied to container image before executing the installations. COPY pyproject.toml poetry.lock /opt/nautobot/
WORKDIR /opt/nautobot
RUN poetry install --no-root
COPY . /opt/nautobot
RUN poetry install
|
Thanks @jifox ! 🙃 |
This feature implements the installation of additional python modules during
invoke build
if the filelocal_requirements.txt
exists in project-directory.