-
Notifications
You must be signed in to change notification settings - Fork 1
/
build-client.sh
executable file
·74 lines (56 loc) · 1.36 KB
/
build-client.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
# dot-tagged: awesome docker, browserify, build klouds, awesome bash
set -o nounset
set -o errexit
envfile='klouds.env'
cloneurl='https://github.com/kloudsio/klouds'
# client build container
docker build -q --tag="bundler" - <<bundler
FROM node:latest
WORKDIR /root
RUN npm install -g babel browserify myth watchify envify
CMD /bin/bash
bundler
# dockerized task
#
# -> clone from github
# -> build
#
docker run -v `pwd`/bundled:/y --env-file="$envfile" -i bundler bash <<source
set -o nounset
set -o errexit
git clone https://github.com/kloudsio/klouds /x
cd /x/client/
npm install
# copy index.html etc.
cp -rvu /x/client/src/public/* /y
# transpile src to -> app.js, app.css
./scripts/deku-wrap.sh
browserify -v -d src/app.js \
-t babelify\
-t envify\
-o /y/app.js
myth src/styles/app.css /y/app.css
source
# the docker
#
# 80 publish /y
# 8080 api
#
docker build -t api --no-cache - <<server
FROM node:latest
EXPOSE 80
EXPOSE 8080
VOLUME /bundled
WORKDIR /root
RUN npm install -g babel
RUN git clone https://github.com/kloudsio/klouds klouds
RUN npm install koa koa-static unruly debug
RUN cd klouds/server && npm install
CMD babel-node klouds/main.js
server
docker run -d --name=redis redis || docker start redis
docker run -it --env-file="$envfile" \
--link=redis:redis \
-v `pwd`/bundled:/bundled \
-p 8000:80 -p 8080:8080 api