add dockerfile for gimlet-cocktail µservices

This commit is contained in:
Sam Dodrill 2015-02-05 12:19:56 -08:00
parent f12b86d8ae
commit ddae18f698
3 changed files with 65 additions and 0 deletions

25
gimlet/Dockerfile Normal file
View File

@ -0,0 +1,25 @@
FROM flitter/init
MAINTAINER Xena <xena@yolo-swag.com>
RUN apt-get update &&\
apt-get -y install libreadline-dev libncurses5-dev libpcre3-dev libssl-dev perl make curl git-core luarocks &&\
luarocks install moonrocks --server=http://rocks.moonscript.org &&\
moonrocks install gimlet-cocktail &&\
moonrocks install moonscript &&\
moonrocks install yaml &&\
moonrocks install xavante &&\
moonrocks install wsapi &&\
moonrocks install wsapi-xavante
ADD prepare.moon /app/prepare.moon
ADD gimlet /etc/service/gimlet/run
ENTRYPOINT /sbin/my_init
ENV PORT 5000
EXPOSE 5000
ENV ENVIRONMENT docker
ONBUILD ADD app.yaml /app/
ONBUILD RUN moon /app/prepare.moon /app/app.yaml
ONBUILD ADD . /app/src
ONBUILD RUN moonc /app/src

5
gimlet/gimlet Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
cd /app/src
gimlet -x app

35
gimlet/prepare.moon Normal file
View File

@ -0,0 +1,35 @@
yaml = require "yaml"
manifest_path = ...
error "Missing manifest_path" if not manifest_path
strip = (str) -> str\match "^%s*(.-)%s*$"
read_cmd = (cmd) ->
f = io.popen cmd, "r"
with strip f\read"*a"
assert f\close!
fin = io.open manifest_path, "r"
app = yaml.load fin\read "*a"
fin\close!
if app.overlay
print "writing overlay for #{app.name or "this application"}"
for step, command in pairs app.overlay
f = io.popen command, "r"
for line in f\lines!
print "#{step} -- #{line}"
assert f\close!
if app.dependencies
print "installing dependencies for #{app.name or "this application"}..."
for _, dep in pairs app.dependencies
print "installing dependency #{dep}"
read_cmd "moonrocks install #{dep}"
print "done!"