Don't generate a startup script in docker - instead add /app to PYTHONPATH

This commit is contained in:
Fabio Manganiello 2019-12-02 09:17:04 +01:00
parent 5f54eaa108
commit 55dd7b0d53
1 changed files with 7 additions and 4 deletions

View File

@ -111,15 +111,18 @@ def generate_dockerfile(deps, ports, cfgfile, devdir, python_version):
&& apk del libjpeg-turbo-dev \\
&& apk del zlib-dev
RUN echo 'cd /app && python -m platypush' > /app/platypush-start.sh
RUN chmod 0755 /app/platypush-start.sh
''')
for port in ports:
content += 'EXPOSE {}\n'.format(port)
content += '\nCMD ["sh", "/app/platypush-start.sh"]\n'
content += textwrap.dedent(
'''
ENV PYTHONPATH /app:$PYTHONPATH
CMD ["python", "-m", "platypush"]
''')
dockerfile = os.path.join(devdir, 'Dockerfile')
print('Generating Dockerfile {}'.format(dockerfile))