diff --git a/gimlet/Dockerfile b/gimlet/Dockerfile new file mode 100644 index 0000000..925ebfb --- /dev/null +++ b/gimlet/Dockerfile @@ -0,0 +1,25 @@ +FROM flitter/init +MAINTAINER Xena + +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 diff --git a/gimlet/gimlet b/gimlet/gimlet new file mode 100755 index 0000000..027cb8c --- /dev/null +++ b/gimlet/gimlet @@ -0,0 +1,5 @@ +#!/bin/bash + +cd /app/src + +gimlet -x app diff --git a/gimlet/prepare.moon b/gimlet/prepare.moon new file mode 100644 index 0000000..eff3e11 --- /dev/null +++ b/gimlet/prepare.moon @@ -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!"