Skip to content

Commit b81f4a8

Browse files
author
Matthew Fisher
committed
feat(controller): make Procfile mandatory
At the moment, all custom Dockerfile apps will not start because the 'start' command is not present in the container. Instead, we can generically parse the Procfile for the process type and start that instead. This makes two important changes: 1) All applications **must** specify a Procfile 2) All custom Dockerfile apps must have access to cat, grep, cut and sh The justification for 1) is so that we have a known place to search for runnable processes. 2) is because of the change from `start web` to parse the Procfile for the process types. fixes #668
1 parent 4c9fb7b commit b81f4a8

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

builder/templates/builder

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ if __name__ == '__main__':
5858
# check for Procfile
5959
dockerfile = os.path.join(temp_dir, 'Dockerfile')
6060
procfile = os.path.join(temp_dir, 'Procfile')
61-
if not os.path.exists(dockerfile) and os.path.exists(procfile):
61+
if not os.path.exists(procfile):
62+
raise Exception('Procfile must exist')
63+
if not os.path.exists(dockerfile):
6264
if os.path.exists('/buildpacks'):
6365
build_cmd = "docker run -i -a stdin -v {cache_dir}:/tmp/cache:rw -v /buildpacks:/tmp/buildpacks deis/slugbuilder".format(**locals())
6466
else:

controller/api/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ def _get_scheduler(self):
257257
def _get_command(self):
258258
c_type = self.type
259259
if c_type:
260-
return 'start {c_type}'
260+
return "cat Procfile | grep ^{c_type} | cut -f 1 -d ' ' --complement | sh -"
261261
else:
262262
return ''
263263

0 commit comments

Comments
 (0)