docker-image: support executing without command

When docker provides a script as argument, it ends with 'exit -'. This means we cannot execute the entrypoint again, because the shell has already exited.

It appears that gitlab explicitly sets environment variables as well in the invocation, so the first unset EXEC_SH is not doing anything. So when invoking something like entrypoint sh -c "true", it will still see EXEC_SH set, invoke a new shell, and then execute the entrypoint again, which will do the actual build.

We can simplify this by accepting no arguments to the entrypoint. In that case, we just execute the command provided by EXEC_COMMAND and avoid the entrypoint being executed thre times.

Merge request reports

Loading