Dockerfile to run python

Running the Python project or script in the docker container is relatively easy. You no need to write a huge script. herein an example.

#Deriving the latest base image
FROM python:3.10
#Setting the working directory
WORKDIR /usr/app/src

# Copying the current directory contents into the container at /usr/app/src
COPY . /usr/app/src

# Installing the requirements
RUN pip install -r requirements.txt

RUN pip install poetry
RUN poetry install

# run python script
CMD ["python", "app/main.py"]

 

Tags