From b950da382e7406c5222f22d7c7af6124b3d6d814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20Abdelkader=20Mart=C3=ADnez=20P=C3=A9rez?= Date: Sun, 5 May 2019 09:37:52 +0200 Subject: [PATCH] Added Dockerfile and removed PATH injection from shell. --- poc/Dockerfile | 7 +++++++ poc/kapow | 8 ++------ 2 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 poc/Dockerfile diff --git a/poc/Dockerfile b/poc/Dockerfile new file mode 100644 index 0000000..29699bd --- /dev/null +++ b/poc/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.7 +RUN pip install pipenv +COPY Pipfile Pipfile.lock /tmp/ +RUN cd /tmp && pipenv install --system --deploy +COPY kapow /usr/bin +COPY bin/* /usr/bin/ +ENTRYPOINT ["/usr/bin/kapow"] diff --git a/poc/kapow b/poc/kapow index 9cc3eba..dfeeec3 100755 --- a/poc/kapow +++ b/poc/kapow @@ -228,9 +228,7 @@ def handle_route(entrypoint, command): args, env={**os.environ, "KAPOW_URL": "http://localhost:8080/kapow", - "KAPOW_CONNECTION": id, - "PATH": ":".join([os.path.join(os.path.dirname(os.path.realpath(__file__)), "bin"), - os.environ["PATH"]]), + "KAPOW_CONNECTION": id }, stdin=asyncio.subprocess.DEVNULL) @@ -297,12 +295,10 @@ async def run_init_script(app): print(f"Usage: sys.argv[0] ") os._exit(1) - binpath = os.path.join(os.path.dirname(os.path.realpath(__file__)), "bin") shell_task = await asyncio.create_subprocess_shell( cmd, env={**os.environ, - "KAPOW_URL": "http://localhost:8080/kapow", - "PATH": ":".join([binpath, os.environ["PATH"]]), + "KAPOW_URL": "http://localhost:8080/kapow" }) await shell_task.wait()