0

In 1 folder, there exist a.py, b.by and util.py. Script a and b both import util.py.

I need to build an image running python script a.py and a image running python script b.py

what is the best practice of this?

Akshay barahate
  • 649
  • 8
  • 23
curtank
  • 600
  • 2
  • 7
  • 18
  • Possible duplicate of [How to run my python script on docker?](https://stackoverflow.com/questions/47202705/how-to-run-my-python-script-on-docker) – Akshay barahate Apr 30 '19 at 10:27
  • do you want to implement 2 individual files or both commands in one single docker file? What is the role of folder here ? – Akshay barahate Apr 30 '19 at 10:29
  • Take a look at Docker `ARG`s https://vsupalov.com/docker-arg-env-variable-guide/. You can use them to switch out variables. So something like `ARG script` then later in the Dockerfile `${script:-a.py}`. Then `docker build --build-arg script=b.py` to use script `b.py` instead. This way you only need one Dockerfile. – OrderAndChaos Apr 30 '19 at 12:09

0 Answers0