top of page
Search
Writer's pictureOludare Odewenwa

Creating a Botpress Docker Image



Step 1: Create a docker account at https://www.docker.com

Step 2: Install Docker Desktop App for the version of OS you are using


Step 3: Sign in to your docker desktop app and ensure it is running on your pc

Step 4: Create a new folder in the Documents and name it “Dockerfile”

Step 5: Add the ‘data folder’ of your existing chat bots to the “Dockerfile” folder

Step 6: Add ‘bp.exe’ file of your existing chat bots to the “Dockerfile” folder

Step 7: Create a new docker file using visual studio code and name it ‘dockerfile’ inside the “Dockerfile” folder. Please note the case sensitivity.

Step 8: Add the following snippet to the file and save it.


FROM botpress/server:v11_9_9

ADD . /botpress

ADD . /data

WORKDIR /botpress

CMD ["./bp"]


*FROM botpress/server: (the version of the botpress you used in building your existing chatbot)

**WORKDIR – This is directory of your botpress application that runs on your local machine.

***ADD – This specify files/folders you want to add to your package.

****CMD – This specifies what the command to run when the image is called.


Here is the structure of the folder:


Step 9: Open the command prompt and let’s build the image

Step 10: Navigate to the ‘Dockerfile’ folder you created in Step 4.

Step 11: Run the docker build command as shown below:

docker build -t opon-demo:latest .

Step 12: Once your image is successfully built, it will show in your docker desktop application immediately.


Congratulations you have successfully built a docker image of your botpress chatbot



Pushing Docker Image to Docker Hub Repository

Docker hub is an online repository for docker images. Docker images can be pushed to the docker as well as other repositories such as Heroku. First create a repository under your account in dockerhub and then push images to it by running this command below in command prompt

docker push <username>/<repo>:<tag>


For example:

docker push oodewena/opon-demo:latest



Pushing Docker Image to Heroku


Heroku is a platform as a service based on a managed container system, with integrated data services and a powerful ecosystem, for deploying and running modern apps. Docker image can be deployed and run on Heroku as well. Below is the process of pushing docker image to Heroku


Step 1: Go to www.heroku.com and create an account

Step 2: Select ‘New’ on your home page and select ‘Create New App’

Step 3: Given the ‘name of the app’ and select the region

Step 4: Go to https://devcenter.heroku.com/articles/heroku-cli to download and install Heroku CLI for the version of OS you are using

Step 5: Open the command prompt and enter “heroku login” and wait for the prompt to press any key to open the browser

Step 6: Enter your log in credential and return to the command prompt. You should now be logged in as ….(username)

Step 7: Enter “heroku container:login” to login to Heroku container. You should see “login succeeded”

Step 8: Enter “docker tag opon-demo registry.heroku.com/opon-demo/web” to tag your docker image to your heroku application name. Note your docker image name and the Heroku application name should be the same (case sensitive)

Step 9: Enter “docker push registry.heroku.com/opon-demo/web” to push the docker image to the Heroku registry.

Step 10: Enter “heroku container:release web --app opon-demo” to release your application in Heroku for web access.


Your application should now be accessible on https://opon-demo.herokuapp.com



728 views0 comments

Recent Posts

See All

Comentários


bottom of page