Containerizing the application with Docker
Before deploying your Haystack chatbot to Google Cloud Run, the application must be packaged into a Docker container. Containerization allows you to bundle your code, dependencies, and environment into a single, portable unit that runs consistently across different systems—including the cloud.
In this section, you will create a Dockerfile, which defines the steps required to build a Docker image of your chatbot. This image will then be deployed to Cloud Run as a serverless web service.
Here is the Dockerfile used to containerize your Haystack chatbot:
FROM python:3.11
EXPOSE 8080
WORKDIR /app
COPY . ./
RUN pip install -r requirements.txt
CMD ["python", "app.py"]
Let us break down what each line does:
FROM python:3.11
: This sets the base image to Python 3.11, which includes everything needed to run Python applications.EXPOSE 8080
: Cloud Run expects the application to listen on port...