From 0c9275bf174412f3ec97e3745335dbf555982f5e Mon Sep 17 00:00:00 2001 From: Greg Walker Date: Mon, 7 Sep 2015 13:46:19 -0500 Subject: [PATCH] Adding ability to create stand-alone docker instance --- Dockerfile | 34 ++++++++++++++++++++++++++++++++++ supervisord.conf | 15 +++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 Dockerfile create mode 100644 supervisord.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..13bd8f1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +# This file describes how to build slack-pokemon into a runnable linux container with +# all dependencies installed. + +# Set the base image to Ubuntu +FROM ubuntu + +# Update +run apt-get -y update + +# Install node and npm +###run apt-get -y install nodejs npm +run apt-get -y install nodejs-legacy npm + + +### Currently going to use supervisord to run everything in a single container +# Also install redis locally +run apt-get -y install redis-server +run apt-get -y install supervisor + +add ./supervisord.conf /etc/supervisor/conf.d/supervisord.conf + +# Define working directory +WORKDIR /src +# Copy current directory into container +ADD . /src + +# Get node_modules +run npm install + +# Expose slack-pokemon's port (no need to expose redis) +EXPOSE 5000 + +# Start supervisor +cmd ["supervisord", "-n"] diff --git a/supervisord.conf b/supervisord.conf new file mode 100644 index 0000000..accf3a8 --- /dev/null +++ b/supervisord.conf @@ -0,0 +1,15 @@ +[supervisord] +nodaemon=true + +[program:redis] +user=redis +command=/usr/bin/redis-server +stdout_logfile=/var/log/supervisor/%(program_name)s.log +stderr_logfile=/var/log/supervisor/%(program_name)s.log +autorestart=true + +[program:slack-pokemon] +command=npm start +stdout_logfile=/var/log/supervisor/%(program_name)s.log +stderr_logfile=/var/log/supervisor/%(program_name)s.log +autorestart=true