2
0
mirror of https://github.com/cmehay/pyentrypoint synced 2024-10-30 15:21:11 +00:00

Merge pull request #18 from scottjs/dockerenv_config

Added config option to specify whether or not to remove the dockerenv and dockerinit files
This commit is contained in:
Christophe Mehay 2019-03-21 18:10:37 +01:00 committed by GitHub
commit d1dd94765d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

3
pyentrypoint/command.py Normal file → Executable file
View File

@ -99,7 +99,8 @@ class Command(object):
def run(self): def run(self):
if not self.is_handled: if not self.is_handled:
self._exec() self._exec()
self._rm_dockerenv() if self.config.remove_dockerenv:
self._rm_dockerenv()
if os.getuid() is 0: if os.getuid() is 0:
os.setgid(self.config.group) os.setgid(self.config.group)
os.setuid(self.config.user) os.setuid(self.config.user)

7
pyentrypoint/config.py Normal file → Executable file
View File

@ -226,6 +226,13 @@ class Config(ConfigMeta):
return bool(self._config['clean_env']) return bool(self._config['clean_env'])
return True return True
@property
def remove_dockerenv(self):
"""Remove dockerenv and dockerinit files"""
if 'remove_dockerenv' in self._config:
return bool(self._config['remove_dockerenv'])
return True
@property @property
def debug(self): def debug(self):
"""Enable debug logs.""" """Enable debug logs."""