2017-04-16 18:58:03 +00:00
|
|
|
from "xena/go-mini:1.8.1"
|
2017-03-25 18:01:52 +00:00
|
|
|
|
|
|
|
### setup go
|
2017-04-16 18:58:03 +00:00
|
|
|
run "go1.8.1 download"
|
2016-12-18 20:11:06 +00:00
|
|
|
|
|
|
|
### Copy files
|
|
|
|
run "mkdir -p /site"
|
2017-01-09 21:41:39 +00:00
|
|
|
|
2017-01-10 20:39:41 +00:00
|
|
|
def debug?()
|
2017-04-16 19:54:10 +00:00
|
|
|
getenv("DEBUG") == "yes"
|
2017-01-10 20:39:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def debug!()
|
|
|
|
run "apk add --no-cache bash"
|
|
|
|
debug
|
|
|
|
end
|
|
|
|
|
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
|
|
|
|
2017-03-25 18:01:52 +00:00
|
|
|
copy "vendor/", "/root/go/src/"
|
2017-01-10 20:39:41 +00:00
|
|
|
|
2016-12-18 20:11:06 +00:00
|
|
|
### Build
|
2017-03-25 18:16:13 +00:00
|
|
|
run "apk add --no-cache --virtual site-builddep build-base"
|
2017-01-09 22:58:07 +00:00
|
|
|
run %q[ cd /site && sh ./build.sh ]
|
2017-01-10 20:39:41 +00:00
|
|
|
debug! if debug?
|
2016-12-18 20:11:06 +00:00
|
|
|
|
|
|
|
### Cleanup
|
2017-03-25 18:16:13 +00:00
|
|
|
run %q[ rm -rf /root/go /site/backend /root/sdk ]
|
2017-04-16 19:54:10 +00:00
|
|
|
run %q[ apk del git go1.8.1 site-builddep ]
|
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"
|