Added support for config include files to Docker images too
This commit is contained in:
parent
bf61259517
commit
a1f640ce0a
1 changed files with 17 additions and 5 deletions
|
@ -66,13 +66,25 @@ def generate_dockerfile(deps, ports, cfgfile, devdir):
|
||||||
RUN mkdir -p /usr/local/share/platypush\n
|
RUN mkdir -p /usr/local/share/platypush\n
|
||||||
''').lstrip()
|
''').lstrip()
|
||||||
|
|
||||||
|
srcdir = os.path.dirname(cfgfile)
|
||||||
cfgfile_copy = os.path.join(devdir, 'config.yaml')
|
cfgfile_copy = os.path.join(devdir, 'config.yaml')
|
||||||
with open(cfgfile) as src_f:
|
subprocess.call(['cp', cfgfile, cfgfile_copy])
|
||||||
with open(cfgfile_copy, 'w') as dest_f:
|
content += 'COPY config.yaml /etc/platypush/\n'
|
||||||
for line in src_f:
|
|
||||||
dest_f.write(line)
|
for include in Config._included_files:
|
||||||
|
incdir = os.path.relpath(os.path.dirname(include), srcdir)
|
||||||
|
destdir = os.path.join(devdir, incdir)
|
||||||
|
|
||||||
|
try:
|
||||||
|
os.makedirs(destdir)
|
||||||
|
except FileExistsError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
subprocess.call(['cp', include, destdir])
|
||||||
|
content += 'RUN mkdir -p /etc/platypush/' + incdir + '\n'
|
||||||
|
content += 'COPY ' + os.path.relpath(include, srcdir) + \
|
||||||
|
' /etc/platypush/' + incdir + '\n'
|
||||||
|
|
||||||
content += 'COPY config.yaml /etc/platypush/'
|
|
||||||
|
|
||||||
content += textwrap.dedent(
|
content += textwrap.dedent(
|
||||||
'''
|
'''
|
||||||
|
|
Loading…
Reference in a new issue