Setting Dockerfile ENV variables via .txt file

Viewed 32

I Currently have a fruit.txt file that looks like this

BEST_FRUIT=apple
WORST_FRUIT=kiwi

In my dockerfile, I would like to set ENV variables based off of what is inside the txt file. I am aware of using --env-file but I do not have a docker-compose file currently. How would I go about so my Dockerfile ENV variables would look like:

ENV BEST_FRUIT=<apple from fruit.txt>
ENV WORST_FRUIT=<kiwi from fruit.txt>
0 Answers
Related