forked from cadey/xesite
add needed files for deployment
This commit is contained in:
parent
41577508f6
commit
9d15fb314f
|
@ -0,0 +1 @@
|
|||
FROM xena/christine.website
|
|
@ -130,7 +130,12 @@ func main() {
|
|||
http.Handle("/static/", http.FileServer(http.Dir(".")))
|
||||
http.HandleFunc("/", writeIndexHTML)
|
||||
|
||||
log.Fatal(http.ListenAndServe(":9090", nil))
|
||||
port := os.Getenv("PORT")
|
||||
if port == "" {
|
||||
port = "9090"
|
||||
}
|
||||
|
||||
log.Fatal(http.ListenAndServe(":"+port, nil))
|
||||
}
|
||||
|
||||
func writeBlogPosts(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
from "phusion/baseimage:0.9.19"
|
||||
|
||||
copy "./runit/", "/etc/system/"
|
||||
|
||||
run %q[ curl -o backplane-stable-linux-amd64.tgz https://bin.equinox.io/c/jWahGASjoRq/backplane-stable-linux-amd64.tgz \
|
||||
&& tar xf backplane-stable-linux-amd64.tgz \
|
||||
&& mv backplane /usr/bin/backplane \
|
||||
&& rm backplane-stable-linux-amd64.tgz ]
|
||||
|
||||
run %q[ cd /usr/local && curl -o go.tar.gz https://storage.googleapis.com/golang/go1.7.4.linux-amd64.tar.gz \
|
||||
&& tar xf go.tar.gz && rm go.tar.gz && mkdir -p /go/src ]
|
||||
env "GOPATH" => "/go"
|
||||
run %q[ apt-get update && apt-get install -y git-core \
|
||||
&& /usr/local/go/bin/go get github.com/gernest/front && /usr/local/go/bin/go get gopkg.in/yaml.v2 ]
|
||||
|
||||
run %q[ apt-get update && apt-get install xz-utils bzip2 ]
|
||||
|
||||
run %q[ cd /usr/local && curl -o node.tar.xz https://nodejs.org/dist/v6.9.2/node-v6.9.2-linux-x64.tar.xz \
|
||||
&& tar xf node.tar.xz && mv node-v6.9.2-linux-x64 node && rm node.tar.xz ]
|
||||
|
||||
### Copy files
|
||||
run "mkdir -p /site"
|
||||
copy "./backend", "/site/backend"
|
||||
copy "./blog", "/site/blog"
|
||||
copy "./frontend/package.json", "/site/frontend/package.json"
|
||||
copy "./frontend/bower.json", "/site/frontend/bower.json"
|
||||
copy "./frontend/webpack.production.config.js", "/site/frontend/webpack.production.config.js"
|
||||
copy "./frontend/src", "/site/frontend/src"
|
||||
copy "./frontend/support", "/site/frontend/support"
|
||||
copy "./static", "/site/static"
|
||||
copy "./build.sh", "/site/build.sh"
|
||||
copy "./run.sh", "/site/run.sh"
|
||||
|
||||
### Build
|
||||
run %q[ cd /site && bash ./build.sh ]
|
||||
|
||||
### Cleanup
|
||||
run %q[ rm -rf /usr/local/go /usr/local/node /site/frontend/node_modules /site/frontend/bower_components /go /site/backend ]
|
||||
run %q[ apt-get remove -y xz-utils bzip2 git-core ]
|
||||
|
||||
### Runtime
|
||||
entrypoint "/sbin/my_init"
|
||||
cmd "/site/run.sh"
|
||||
|
||||
flatten
|
||||
tag "xena/christine.website"
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -x
|
||||
|
||||
export PATH="$PATH:/usr/local/go/bin:/usr/local/node/bin"
|
||||
export CI="true"
|
||||
|
||||
(cd /site/frontend
|
||||
yes | npm install
|
||||
npm install -g bower
|
||||
yes 2 | bower install --allow-root
|
||||
npm run build
|
||||
rm -rf bower_components node_modules) &
|
||||
|
||||
(cd /site/backend/christine.website
|
||||
go build
|
||||
mv christine.website /usr/bin) &
|
||||
|
||||
wait
|
|
@ -12,5 +12,8 @@
|
|||
"purescript-pux-devtool": "^4.1.0",
|
||||
"purescript-argonaut": "^2.0.0",
|
||||
"purescript-affjax": "^3.0.2"
|
||||
},
|
||||
"resolutions": {
|
||||
"purescript-dom": "^3.1.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ -n "$BACKPLANE_TOKEN" ]
|
||||
then
|
||||
/usr/bin/backplane connect
|
||||
else
|
||||
sleep 999d
|
||||
fi
|
Loading…
Reference in New Issue