Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Start api and playground simultaneously [WIP]

Tomáš Valenta0b256ffcc8b1
diff --git a/api-service/Dockerfile b/api-service/Dockerfile
index b4e4fb039..a912a5bba 100644
--- a/api-service/Dockerfile
+++ b/api-service/Dockerfile
@@ -17,6 +17,7 @@ RUN yarn --frozen-lockfile
COPY playground/tsconfig.json ./
COPY playground/tsoa.json ./
+COPY playground/scripts/build.js ./scripts/build.js
COPY playground/src ./src
RUN yarn build
@@ -59,5 +60,5 @@ WORKDIR /app/cf-worker-template
COPY --from=cf-worker-modules ./app/cf-worker-template ./
WORKDIR /app
-CMD exec poetry run gunicorn --bind 0.0.0.0:$PORT --workers 1 --threads 8 --timeout 0 app:app
+CMD ./start.sh
diff --git a/api-service/start.sh b/api-service/start.sh
new file mode 100755
index 000000000..edf795e5f
--- /dev/null
+++ b/api-service/start.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+# Start playground api
+cd /playground && node lib/server.js &
+
+# Start python app
+cd /app && exec poetry run gunicorn --bind 0.0.0.0:$PORT --workers 1 --threads 8 --timeout 0 app:app &
+
+# Wait for any process to exit
+wait -n
+
+# Exit with status of process that exited first
+exit $?