Commit 6740a8ae authored by BAIRE Anthony's avatar BAIRE Anthony
Browse files

use the ENTRYPOINT defined in the docker image if any

Now that users can push their image to the registry, it is much more
straightforward to let them configure the app entrypoint with an
ENTRYPOINT directive in the Dockerfile.

Note: if the image has no entrypoint, then we fall back to the global
entrypoint defined in the webapp (Webapp.entrypoint)
parent 6dba797b
Pipeline #139007 failed with stages
in 1 second
......@@ -1119,9 +1119,16 @@ class JobManager(Manager):
job_path = ctrl.gen_job_path(job)
log.debug("job.path: %r", job_path)
entrypoint = [webapp.entrypoint]
if info.ver_id is None:
assert info.version == "sandbox"
image = tmp_img = info.client.commit(ctrl.gen_sandbox_name(webapp))["Id"]
else:
# use the ENTRYPOINT defined in the image (if any)
image_entrypoint = info.client.inspect_image(image)["Config"]["Entrypoint"]
if image_entrypoint and image_entrypoint != [""]:
entrypoint = image_entrypoint
# ensure that the job dir exists before actually running the job
# (because the docker daemon creates them on-the-fly which makes
......@@ -1222,7 +1229,7 @@ class JobManager(Manager):
exit $code
""".format(job_id=job.id),
"job%d" % job.id, webapp.entrypoint] + shlex.split(job.param),
"job%d" % job.id, *entrypoint] + shlex.split(job.param),
labels = {"allgo.tmp_img": tmp_img or ""},
environment=["constraint:node==" + info.node_id],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment