You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Docker Example - Hubot Slack bot container image built with Ansible
2
+
3
+
This is an example lightweight Docker image build using Ansible which builds a usable Hubot chat bot that works with Slack. The example is explained in more detail in Chapter 13 of [Ansible for DevOps](https://www.ansiblefordevops.com/).
4
+
5
+
## Get a Slack API Token for your bot
6
+
7
+
Follow the instructions in Slack's guide, [Slack Developer Kit for Hubot](https://slackapi.github.io/hubot-slack/), and get an API token for a bot attached to a new App installed in the workspace of a Slack organization.
8
+
9
+
## Build the Hubot container image
10
+
11
+
Make sure you have Docker installed on the workstation or VM where this playbook is located, then enter the command:
12
+
13
+
$ ansible-playbook main.yml
14
+
15
+
This will generate a Docker image named `a4d/hubot-slack`, which you should see listed when you run `docker images`.
16
+
17
+
## Run the Hubot container image
18
+
19
+
To run the image, run the command below, replacing `TOKEN_HERE` with the API token your bot uses from Slack:
20
+
21
+
$ docker run -d --name "hubot-slack" -e HUBOT_
22
+
SLACK_TOKEN=TOKEN_HERE a4d/hubot-slack
23
+
24
+
The container should be running in the background. You can inspect the logs from the bot using `docker logs hubot-slack`, and you can kill and remove the container with `docker rm -f hubot-slack`.
25
+
26
+
## About the Author
27
+
28
+
This project was created by [Jeff Geerling](https://www.jeffgeerling.com/) as an example for [Ansible for DevOps](https://www.ansiblefordevops.com/).
0 commit comments