Don't run useradd for root
When running dox with an user_map check whether the user is root and skip the useradd command on image build if so. Most (all?) images have a root user anyway. Change-Id: I08eb60254fb437e02c61025d0a7761eb774c11f3
This commit is contained in:
parent
1f63004479
commit
ea141b9715
|
@ -148,11 +148,13 @@ class Runner(object):
|
||||||
dockerfile.append("FROM %s" % image)
|
dockerfile.append("FROM %s" % image)
|
||||||
try:
|
try:
|
||||||
tempd = tempfile.mkdtemp()
|
tempd = tempfile.mkdtemp()
|
||||||
dockerfile.append(
|
if not self.user_map['username'] == 'root':
|
||||||
"RUN useradd -M -U -d /src -u %(uid)s %(user)s" % dict(
|
dockerfile.append(
|
||||||
uid=self.user_map['uid'],
|
"RUN useradd -M -U -d /src -u %(uid)s %(user)s" % dict(
|
||||||
gid=self.user_map['gid'],
|
uid=self.user_map['uid'],
|
||||||
user=self.user_map['username']))
|
gid=self.user_map['gid'],
|
||||||
|
user=self.user_map['username']))
|
||||||
|
|
||||||
for add_file in commands.get_add_files():
|
for add_file in commands.get_add_files():
|
||||||
shutil.copy(add_file, os.path.join(tempd, add_file))
|
shutil.copy(add_file, os.path.join(tempd, add_file))
|
||||||
dockerfile.append("ADD %s /dox/" % add_file)
|
dockerfile.append("ADD %s /dox/" % add_file)
|
||||||
|
|
Loading…
Reference in New Issue