From 8db1b9d47e176f4d412005ab2a259e7693b3630a Mon Sep 17 00:00:00 2001 From: Rajesh Rajendran Date: Fri, 21 May 2021 21:30:44 +0530 Subject: [PATCH] feat(chalice): included sourcemaps_reader It's not advised to run multiple processes in a single docker container. In Kubernetes we can run this as sidecar, but other platforms such as Heroku, and vanilla docker doesn't support such feature. So till we figure out better solution, this is the workaround. --- api/Dockerfile | 10 +++++++++- api/entrypoint.sh | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100755 api/entrypoint.sh diff --git a/api/Dockerfile b/api/Dockerfile index 0ca8c1edf..84d1b88f5 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -4,6 +4,14 @@ WORKDIR /work COPY . . RUN pip install -r requirements.txt -t ./vendor --upgrade RUN pip install chalice==1.22.2 +# Installing Nodejs +RUN apt update && apt install -y curl && \ + curl -fsSL https://deb.nodesource.com/setup_12.x | bash - && \ + apt install -y nodejs && \ + apt remove --purge -y curl && \ + rm -rf /var/lib/apt/lists/* && \ + cd sourcemaps_reader && \ + npm install # Add Tini # Startup daemon @@ -13,4 +21,4 @@ ENV ENTERPRISE_BUILD ${envarg} ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini RUN chmod +x /tini ENTRYPOINT ["/tini", "--"] -CMD python env_handler.py && chalice local --no-autoreload --host 0.0.0.0 --stage ${ENTERPRISE_BUILD} \ No newline at end of file +CMD ./entrypoint.sh diff --git a/api/entrypoint.sh b/api/entrypoint.sh new file mode 100755 index 000000000..3c3d12fd5 --- /dev/null +++ b/api/entrypoint.sh @@ -0,0 +1,6 @@ +#!/bin/bash +cd sourcemaps_reader +nohup node server.js &> /tmp/sourcemaps_reader.log & +cd .. +python env_handler.py +chalice local --no-autoreload --host 0.0.0.0 --stage ${ENTERPRISE_BUILD}