My app has two files: 1.py and 2.py, and to work i need to run them on two different terminals , like this:
1 terminal: python3 1.py -f text.txt
2 terminal: python3 2.py
How i need to construct my Dockerfile, to make the image work?
My app has two files: 1.py and 2.py, and to work i need to run them on two different terminals , like this:
1 terminal: python3 1.py -f text.txt
2 terminal: python3 2.py
How i need to construct my Dockerfile, to make the image work?
Docker doesn't have the concept of "terminals". Your best bet is to run two Docker containers, one for each file, and use Docker Compose or a Kubernetes pod (or an equivalent) to run them both simultaneously.
In your Dockerfile, after you copy your files, you can use a pipe in the CMD, so you can run multiple scripts at the same time. Your Dockerfile should look like this (I assume that the files are in your current directory):
FROM python:3.6
COPY 1.py /
COPY 2.py /
COPY text.txt /
CMD python3 1.py -f text.txt | python 2.py