Why chown in entrypoint.sh instead of Dockerfile?
joeyparrish opened this issue · comments
This code in entrypoint.sh confuses me:
[[ $(id -u) -eq 0 ]] && /usr/bin/chown -R runner ${_RUNNER_WORKDIR} /opt/hostedtoolcache/ /actions-runner || :
Why is this done in entrypoint.sh instead of in Dockerfile?
I wouldn't have noticed except that I started running many instances in parallel. While we could debate the merits of my setup (please, let's not), this step bogged things down for me. It seems odd to put static setup like that in entrypoint.sh for ephemeral instances to repeat on every startup.
And I see a very similar line in Dockerfile:
&& chown runner /_work /actions-runner /opt/hostedtoolcache
Should that just be made recursive? Would that suffice to drop the recursive chown in entrypoint.sh?
[[ $(id -u) -eq 0 ]] && /usr/bin/chown -R runner ${_RUNNER_WORKDIR} /opt/hostedtoolcache/ /actions-runner || :
because config.sh runs as root in the offchance that RUN_AS_ROOT
is false and it swaps to runner using gosu
There's likely some optimizations we can do here, but thats for runtime fixing
@joeyparrish let me know if #240 helps (specifically this ). Ill close for now as you genuinely found something I could (and did) optimize
If it doesn't help or i misunderstood just reopen and ping me
Thanks