Reputation: 302
What is the best practice for handling dependencies of a dockerized python project? Would I declare all of them in the Dockerfile or in the requirements.txt?
Upvotes: 1
Views: 351
Reputation: 5643
You can define your dependencies in a requirements.txt
file, then install them with Docker:
RUN pip install -r requirements.txt
Upvotes: 3
Reputation: 7769
The best way to handle the dependencies is using requirements.txt
Try this dockerfile
FROM python:3.8-slim-buster
COPY . /work
WORKDIR /work
RUN apt-get update
RUN apt-get upgrade -y
RUN pip install -r requirements.txt
Upvotes: 3