Skip to content

Commit 730149c

Browse files
author
Gabriel Monroy
committed
feat(builder): update builder to pass SHA/Procfile/Dockerfile (if available)
1 parent c5aec20 commit 730149c

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

builder/templates/builder

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ if __name__ == '__main__':
5656
if rc != 0:
5757
raise Exception('Could not extract git archive')
5858
dockerfile = os.path.join(temp_dir, 'Dockerfile')
59+
procfile = os.path.join(temp_dir, 'Procfile')
5960
# pull config to be used during build
6061
body = {}
6162
body['receive_user'], body['receive_repo'] = user, app
@@ -113,6 +114,18 @@ if __name__ == '__main__':
113114
body['receive_user'] = user
114115
body['receive_repo'] = app
115116
body['image'] = target_image
117+
# use sha of master
118+
with open(os.path.join(repo_dir, 'refs/heads/master')) as f:
119+
body['sha'] = f.read().strip('\n')
120+
# extract the Procfile and convert to JSON
121+
if os.path.exists(procfile):
122+
with open(procfile) as f:
123+
raw_procfile = f.read()
124+
body['procfile'] = json.dumps(yaml.safe_load(raw_procfile))
125+
# extract Dockerfile
126+
if os.path.exists(dockerfile):
127+
with open(dockerfile) as f:
128+
body['dockerfile'] = f.read()
116129
# trigger build hook
117130
sys.stdout.write('\n Launching... ')
118131
sys.stdout.flush()

0 commit comments

Comments
 (0)