Hi @CAkhil , sorry for the late response. I only dockerised, deploying on ec2 was someone else’s job but i think that should be an easy step if you search it up. Here, I’m sharing with you content of three files that you are required to place in your project in order to dockerize it. These are 2 Dockerfile
and 1 docker-compose.yml
.
After you have made sure your system has docker and docker-compose installed in it,
Create the first Dockerfile
(just a new file with name “Dockerfile”) in root directory of the project and should have this content -
FROM rasa/rasa:2.8.0
WORKDIR '/app'
COPY . /app
USER root
# WORKDIR /app
# COPY . /app
COPY ./data /app/data
RUN rasa train
VOLUME /app
VOLUME /app/data
VOLUME /app/models
CMD ["run","-m","/app/models","--enable-api","--cors","*","--debug" ,"--endpoints", "endpoints.yml", "--log-file", "out.log", "--debug"]
Note that you can change the rasa version here.
Create second Dockerfile
in actions
folder and place this content -
FROM rasa/rasa-sdk:2.8.0
WORKDIR /app
COPY requirements.txt requirements.txt
USER root
RUN pip install --verbose -r requirements.txt
EXPOSE 5055
USER 1001
Note that you have to put requirements.txt
file containing python libraries that you installed and used in the actions
folder.
So, That was all the dockerfiles we needed, now in the root directory, you can see a file called endpoints.yml
. change the name localhost
to action_server
(we’ll register this name in the docker-compose file for container of action server) in the action_endpoint and it should look like -
action_endpoint:
url: "http://action_server:5055/webhook"
Finally, create a docker-compose.yml
file in the root directory and place these content -
version: '3'
services:
rasa:
container_name: "rasa_server"
user: root
build:
context: .
volumes:
- "./:/app"
ports:
- "5005:5005"
action_server:
container_name: "action_server"
build:
context: actions
volumes:
- ./actions:/app/actions
- ./data:/app/data
ports:
- 5055:5055
After all this you can just run the command
docker-compose up --build
This is all what is required to deploy your bot on docker, you should also refer the answer of nik for anything extra he has mentioned but this much is only required to run the bot successfully.