-
Notifications
You must be signed in to change notification settings - Fork 20
/
fabfile.py
49 lines (43 loc) · 1.16 KB
/
fabfile.py
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
# fabric 1.9.0
from fabric.operations import local
from fabric.api import env
'''
This file is collection of commands regarding deployment
'''
env.user = 'oursky'
env.roledefs.update({
'oursky': ['oursky'],
'skygear': ['skygeario'],
})
config = '/home/faseng/.docker'
# Heaven will execute fab -R edge deploy:branch_name=edge
def deploy(branch_name):
print("Executing on %s as %s" % (env.host, env.user))
if branch_name == 'master':
tag = 'latest'
onbuild = 'onbuild'
elif branch_name[0] == 'v':
# Tag is in format of v0.1.0, but docker convention is 0.1.0
tag = branch_name[1:]
onbuild = branch_name[1:] + '-onbuild'
else:
print("Brnach name not in supported format")
return
local('docker build -t %s/py-skygear:%s .' % (
env.host,
tag
))
local('docker build -t %s/py-skygear:%s -f Dockerfile-onbuild .' % (
env.host,
onbuild
))
local('docker --config=%s push %s/py-skygear:%s' % (
config,
env.host,
tag
))
local('docker --config=%s push %s/py-skygear:%s' % (
config,
env.host,
onbuild
))