Wechaty is fully dockerized. So it will be very easy to be used as a MicroService.
Getting Started Template for Docker Users: https://github.com/wechaty/docker-wechaty-getting-started
Quick & easy install Docker via:
Get to know more about Docker at: https://www.docker.com/
The best practice of using Wechaty Docker is like the following:
see? death easy to use!
You might want to confirm that you can download
wechaty/wechatyimage successfully by run
docker pull wechaty/wechaty, and this command is also able to help you upgrade the image to the latest version.
-t: Allocate a pseudo-TTY
-i: Keep STDIN open even if not attached
--rm: Automatically remove the container when it exits
--privileged: Give extended privileges to this container
--network=host: use the Docker host network stack
-e WECHATY_LOG="$WECHATY_LOG": Pass the environment variable
WECHATY_LOGinto the container
--volume="$(pwd)":/bot: Bind current directory(
"$(pwd)") to '
/bot' inside the container, by mounting the volume
wechatyas the container name
wechaty/wechaty:latest: Image name on docker hub, here's our wechaty/wechaty with
mybot.js: File contains code wrote by you, should be placed in current directory
- See Also: Dockerize Wechaty for easy start #66
There's many Wechaty ChatBot Examples in the
example directory, and all of them are writen in TypeScript.
Run example ChatBot is as easy as run hello world example above, as long as you are using Docker:
WECHATY_TOKEN is required here, because you need this key to managing wechaty on the chatbot cloud manager: https://www.chatie.io
Put this line(and only this line) to your
This image makes building derivative images easier. For most use cases, creating a
Dockerfile in the base of your project directory with the line
FROM wechaty/onbuild will be enough to create a stand-alone image for your project.
onbuildvariant is really useful for "getting off the ground running" (zero to Dockerized in a short period of time)
onbuildvariant will only install npm packages according to the
- The npm installs devDependencies by default, which is undesirable if you're building a production image. To avoid this pass NODE_ENV as a build argument i.e.
docker build --build-arg NODE_ENV=production ….
To be written...