Nic
09/23/2022, 5:35 PMNate
09/23/2022, 5:38 PMFROM yourbaseimage
COPY requirements.txt .
RUN pip install -r requirements.txt
Nic
09/23/2022, 5:40 PMZanie
09/23/2022, 6:03 PMDockerContainer(command=[…]).run()
DockerContainer(command=["bash", "-c", "pip install cowsay && echo hi!"])
Nic
09/23/2022, 6:38 PMZanie
09/23/2022, 6:49 PMNic
09/23/2022, 6:51 PMRyan Peden
09/24/2022, 1:12 AMdocker-container
, It sounds like the EXTRA_PIP_PACKAGES
environment variable might help, assuming you are using one of the Prefect base images directly or building atop one?
As the docs note, installing the packages at runtime adds overhead and has disadvantages, but you are the best judge of whether it makes sense for your workflow.
Setting that environment variable (either during deployment or afterward via the block UI) is a bit less convenient than running pip against requirements.txt, but it might be workable? If you want to try it, you can probably flatten requirements.txt into a pip install
compatible string you can put in the environment variable by running awk '{gsub(" ","",$0);printf("%s ",$0)}' requirements.txt
if you're running Linux or MacOS.