Skip to content

Commit

Permalink
Add Docker Compose development environment
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Duffield <tom@chef.io>
  • Loading branch information
tduffield committed Mar 13, 2017
1 parent c0a71e1 commit 52c5119
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,6 +1,7 @@
*.gem
*.rbc
.bundle
.docker_bundle
.config
.yardoc
Gemfile.lock
Expand Down
13 changes: 13 additions & 0 deletions Dockerfile
@@ -0,0 +1,13 @@
FROM ruby:2.3
MAINTAINER Tom Duffield <tom@chef.io>

# We need `git` because oftentimes .gemspec depends on it for listing files
RUN apt-get update && \
apt-get install -y git && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN gem install bundler && mkdir /app
COPY start /start
WORKDIR /app
CMD ["/start"]
6 changes: 6 additions & 0 deletions Gemfile
@@ -1,3 +1,9 @@
source "https://rubygems.org"

gemspec

group :docker do
gem "lita-slack"
gem "guard"
gem "guard-process"
end
8 changes: 8 additions & 0 deletions Guardfile
@@ -0,0 +1,8 @@
# Because we run Lita in a container, don't connect to STDIN
interactor :off

# Restart the lita CLI anytime we modify the lita_config or a lita file
guard "process", name: "Lita", command: "bundle exec lita" do
watch("lita_config.rb")
watch(%r{^lib/*})
end
15 changes: 15 additions & 0 deletions docker-compose.yml
@@ -0,0 +1,15 @@
version: '3'
services:
lita:
build: .
links:
- redis:redis
volumes:
# Sync all the local code to the app directory
- ./:/app
# Since we are syncing the whole directory, we need to make sure our local `.bundle` directory is not over-written
- ./.docker_bundle:/app/.bundle
environment:
- SLACK_TOKEN
redis:
image: redis
12 changes: 12 additions & 0 deletions lita_config.rb
@@ -0,0 +1,12 @@
require "lita/adapters/slack"

Lita.configure do |config|
config.robot.log_level = :debug
config.robot.adapter = :slack
config.robot.admins = ["1"]

# Use the redis host linked via docker-compose
config.redis[:host] = "redis"

config.adapters.slack.token = ENV["SLACK_TOKEN"]
end
7 changes: 7 additions & 0 deletions start
@@ -0,0 +1,7 @@
#!/bin/bash
# This file is intended for use only in the Docker environment. If you wish to run Expeditor locally, please run
# bundle exec lita

bundle install --path /var/bundle --jobs $(nproc) --clean

exec bundle exec guard

0 comments on commit 52c5119

Please sign in to comment.