site/box.rb

40 lines
751 B
Ruby
Raw Normal View History

2017-01-10 02:32:12 +00:00
from "xena/go:1.7.4"
2016-12-18 20:11:06 +00:00
### Copy files
run "mkdir -p /site"
2017-01-09 21:41:39 +00:00
def put(file)
copy "./#{file}", "/site/#{file}"
end
files = [
"backend",
"blog",
2017-01-09 22:58:07 +00:00
"frontend.asar",
2017-01-09 21:41:39 +00:00
"static",
"build.sh",
"run.sh",
2017-01-09 22:58:07 +00:00
# This file is packaged in the asar file, but the go app relies on being
# able to read it so it can cache the contents in ram.
"frontend/static/dist/index.html",
2017-01-09 21:41:39 +00:00
]
2017-01-09 22:58:07 +00:00
files.each { |x| put x }
2016-12-18 20:11:06 +00:00
### Build
2017-01-09 22:58:07 +00:00
run "apk add --no-cache git"
run %q[ cd /site && sh ./build.sh ]
2016-12-18 20:11:06 +00:00
### Cleanup
2017-01-09 22:58:07 +00:00
run %q[ rm -rf /usr/local/go /usr/local/node /site/frontend/node_modules /site/frontend/bower_components /go /site/backend /tmp/phantomjs ]
run %q[ apk del go git ]
2016-12-18 20:11:06 +00:00
### Runtime
cmd "/site/run.sh"
2017-01-09 21:41:39 +00:00
env "USE_ASAR" => "yes"
2016-12-18 20:11:06 +00:00
flatten
tag "xena/christine.website"