This is the guide for preparing Bluemix and Docker environments
-
Click here to download the
docker branch -
After downloading, unzip file
Chatbot-docker.zip
-
After register the Bluemix account, then sign in
-
Go to Bluemix catalog, search
Visual Recognition
-
Click
Createbutton after selecting theFree plan
-
Click on
Service credentialstab, then select credential dropdown button, copyapi_key
-
Update
/Chatbot-docker/docker/Dockerfile, paste copiedapi_keytoDockerfile
-
Please be aware of the variables of the values DO NOT HAVE quotes
-
Good example:
ENV VISUAL_RECOGNITION_API_KEY abcdefghijklmnopqrstuvwxyz12345678901234 -
Bad example
ENV VISUAL_RECOGNITION_API_KEY "abcdefghijklmnopqrstuvwxyz12345678901234"
-
Train Visual Recognition API with the training files, get new trained classifier ID then apply it in /Chatbot-docker/docker/Dockerfile
-
Go back to Bluemix console, go back to
Managetab then click onVisual Recognition Tool (Beta)button to launch theVisual Recognition Tool
-
Due to the GFW blocked the unsecured connection of Bluemix as below, use https://visual-recognition-tooling.mybluemix.net/
-
For the first time visit of this tool, the API key is needed for authentication
-
Then click on
Createbutton to get started
-
You will see this page, go to next step refer to following step
-
Choose training zip files from
/Chatbot-trainingfolder, then chooseALLof them according to the class names including the negative sample
-
Name each of the classes
-
Copy the
classifier ID
-
Paste
classifier IDin/Chatbot-docker/docker/Dockerfile
-
Go to Bluemix catalog, search
Conversation
-
Name service as you want, and make sure there is a
Credential nameavailable then click onCreatebutton
-
Then you will see this page, and click on
Service credentials, then copy username and password
-
Paste
usernameandpasswordin/Chatbot-docker/docker/Dockerfile
-
Start creating a new
Conversation, click onManagemenu on the left then click onLaunch tool
-
For the first time visit of this tool, the IBM ID is needed for authentication, but as long as you've authenticated by Bluemix, it will treat you as a authorized user after clicking on the
Log in with IBM IDby default. Otherwise you can try to sign in again with your Bluemix credentials
-
Click on
Uploadicon to upload the training file, to locate the training file, go to/Chatbot-docker/trainings/conversationfolder, findinnovation-day.jsonfile
-
There will be one more panel named
iChat, click on the menu on the top right, then selectView detailsin order to copy workspace ID
-
Paste
workspace IDin/Chatbot-docker/docker/Dockerfile
-
Go to Bluemix catalog, search
Speech to Text
-
Name service as you want, and make sure there is a
Credential nameavailable then click onCreatebutton
-
Then you will see this page below, go to next step refer to following step
-
Copy
usernameandpassword, paste them toDockerfileand save the file
-
Go to Bluemix catalog, search
Text to Speech
-
Then you will see this page below, go to next step refer to following step, then copy username and password
-
Paste
usernameandpasswordin/Chatbot-docker/docker/Dockerfile
Update /Chatbot-docker/docker/Dockerfile with your Blockchain service UR, replace it with actual one if you're hosting the Blockchain service on the Bluemix (refer to Blockchain practice)
ENV APPLICATION_API_URL https://your_block_chain_service.mybluemix.net
If you are hosting the Blockchain service locally, obtain IP address first:
-
macOS: Go to
System Preferences->Network, then copy your IP address
-
Windows: Refer this guide to get the IP address
-
Replace the URL with service URL (with your
IPaddress)ENV APPLICATION_API_URL http://xxx.xxx.xxx.xxx:3000
Now you're ready for building the Docker image.
-
Go to
/Chatbot-docker/docker/folder under the Chatbot project root folder from theTerminalorcmd -
Find your
TerminalfrommacOS
-
Find your
cmdfromWindows
-
Find your project folder, e.g.
/path/to/Chatbot-docker/docker, then run the command:cd /path/to/Chatbot-docker/docker -
To build the Docker image, run the command by tagging it as
chatbot:docker build -t chatbot -f Dockerfile ./
-
Run the command:
docker run -p 8888:9080 chatbot
Now you can visit your Chatbot web application via
- macOS: http://localhost:8888/Chatbot
- Windows: Refer to section
Install docker on Windows 10 (5, 6), so the format of the URL would be likehttp://xxx.xxx.x.x:8888/Chatbot
-
If you encounter an issue like the output from
Terminalorcmdas below after running thedocker buildcommand:Sending build context to Docker daemon 4.246MB Step 1/15 : FROM websphere-liberty:webProfile7 Get https://registry-1.docker.io/v2/library/websphere-liberty/manifests/webProfile7: unauthorized: incorrect username or password -
Please run this command:
docker logout
Then try to re-build the Docker.
