Dockerizing my rasa chatbot application that has botfront

@mangesh

Please find the steps as per our discussion:

For Wordpress:

  1. For creating a docker image for Wordpress site for deployment purpose only; running on localhost 8000 Quick Wordpress Setup With Docker - YouTube
  2. Deploying rasa on Wordpress site please follow this link DEPLOY RASA CHATBOT TO WORDPRESS WEBSITE | WORDPRESS | INNOVATE YOURSELF - YouTube

For Docker Environment:

  1. Create the Dockerhub ID from https://hub.docker.com

  2. Create a Docker image for action server by the name Dockerfile (blue logo), if you have any requirements, please make a requirement.txt file in the same folder with all the packages in it.

Snippet code:

FROM rasa/rasa-sdk:2.7.0
WORKDIR /app
COPY requirement.txt requirement.txt
USER root
RUN pip install -r requirement.txt
EXPOSE 5055
USER 1001

Note: If you did not require the requirement.txt file at the moment please commented

  1. Dockerfile for Rasa; create outside the actions folder where other related files by the name Dockerfile (blue logo)

Snippet code:

FROM rasa/rasa:2.7.1
WORKDIR  '/app'
COPY . /app
USER root

RUN  rasa train 

VOLUME /app/models


CMD [ "run","-m","/app/models","--enable-api","--cors","*","--debug" ,"--endpoints", "endpoints.yml", "--log-file", "out.log", "--debug"]

EXPOSE 5005
  1. Create the docker-compose.yml file same as you created the above file outside the actions folder by the name docker-compose.yml (pink logo)

Snippet code:

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

Note: Update in endpoints.yml

action_endpoint:
  url: 'http://action_server:5055/webhook'

RUN the docker compose

  1. docker-compose up --build or after the build docker-compose up -d please see all the docker related commands.

  2. To check the container running or not docker ps or docker ps -a or docker-compose ps etc

  3. Copy a container from docker to localhost; run the command from terminal (should be in project folder)

docker cp <container ID or name>:"/app" "."

  1. Inspect the rasa server or action server as per need to see the content

docker exec -u root -t -i actions_server /bin/bash

Note: You will be able to run and execute all this whist if you are working on Window, Mac Or Ubuntu. If you have any issue whilst using this solution please mention me :wink:

This is my first ever so long post for any suggestion or solution with such a detail information. I hope it will solve your issue. Good Luck! Bro! Have fun :slight_smile:

7 Likes