Reputation: 61
I want to manually change some source code in a .py file inside gensim
library, which is installed inside a docker image after pip install -r requirements.txt
which has gensim
library version specified inside.
Since I'm using requirements.txt
, changing source code locally (or on ec2) then building won't solve the problem.
Changing docker image after I pull it won't solve the problem since it won't be easily repeatable for other computers.
My current thought is to have that edited .py file inside the same directory as Dockerfile
and make my application.py
import from the modified .py file and build the image. Is (this a good way or) there a better way for docker to install a customized library?
Upvotes: 1
Views: 5468
Reputation: 40366
If you 'own' the image and Dockerfile, then you can add the python file in it:
RUN pip install --requirement requirements.txt
ADD changed_source.py intended_location
...
If you don't own the image|Dockerfile, then a better practice is to derive a new image from it:
FROM the-other-file:tag
ADD changed_source.py intended_location
...
Make sense?
Upvotes: 1