Aviral Kumar
Aviral Kumar

Reputation: 824

Docker File Updates for a Python Project

I currently have a dockerfile which installs python libraries in the container which i eventually use to execute code. Now for every release , I need to add or update the dependencies , which results in rebuilding the image.

The issue is while rebuilding many internal transitive libraries create version issues which effects my functionality , for eg some library can bring in a new numpy library version which can cause issues in the code.

How should I handle this problem ? Should I create a new base image for every release and update it in dockerfile ?

Edit : Caching does not help me , because the moment my requirement.txt file change , rebuild will happen. Also , I cant specify versions for all libraries. Transitive libraries are a challenge here.

Upvotes: 0

Views: 87

Answers (1)

Shanavas M
Shanavas M

Reputation: 1629

This is not related to Docker. You can either pin the package version in requirement.txt or use Poetry to manage the dependencies. Poetry uses a lock file which makes sure the proper version is installed for all the dependencies.

Upvotes: 1

Related Questions