Enforce root user at the beginning of container build

As long as we use a "standard" base image such as ubi8, we're already
root in the container when we run the different steps (SHELL, RUN, COPY
and so on).

But if we decide to inherit from another image that is actually setting
another value for USER (for instance, in TCIB, by passing
`tcib_user=foo'), we end up with permissions issues, preventing to
extend the inherited container.

This patch corrects this issue, enforcing the root user before anything
happens.

Change-Id: Ieb0677cae23384ee92f6a103dab8cd530591dd8d
This commit is contained in:
Cédric Jeanneret 2021-09-03 13:35:47 +02:00
parent 82aeb6d602
commit a34591b344
1 changed files with 1 additions and 0 deletions

View File

@ -23,6 +23,7 @@ LABEL {{ key }}={{ value | to_json }}
{% for key, value in tcib_envs.items() %}
ENV {{ key }}={{ value | to_json }}
{% endfor %}
USER root
{% for item in tcib_onbuilds %}
ONBUILD {{ item }}
{% endfor %}