diff --git a/apps/api/Dockerfile b/apps/api/Dockerfile index 527a6dc7..22aa995c 100644 --- a/apps/api/Dockerfile +++ b/apps/api/Dockerfile @@ -37,4 +37,6 @@ COPY --from=go-base /app/src/lib/go-html-to-md/html-to-markdown.so /app/dist/src # Start the server by default, this can be overwritten at runtime EXPOSE 8080 -ENV PUPPETEER_EXECUTABLE_PATH="/usr/bin/chromium" \ No newline at end of file +ENV PUPPETEER_EXECUTABLE_PATH="/usr/bin/chromium" + +ENTRYPOINT "/app/docker-entrypoint.sh" \ No newline at end of file diff --git a/apps/api/docker-entrypoint.sh b/apps/api/docker-entrypoint.sh new file mode 100755 index 00000000..21122b06 --- /dev/null +++ b/apps/api/docker-entrypoint.sh @@ -0,0 +1,18 @@ +#!/bin/bash -e + +if [ $UID -eq 0 ]; then + ulimit -n 65535 + echo "NEW ULIMIT: $(ulimit -n)" +else + echo ENTRYPOINT DID NOT RUN AS ROOT +fi + +if [ $FLY_PROCESS_GROUP -eq "app" ]; then + node --max-old-space-size=8192 dist/src/index.js +elif [ $FLY_PROCESS_GROUP -eq "worker" ]; then + node --max-old-space-size=8192 dist/src/services/queue-worker.js +else + echo "NO FLY PROCESS GROUP, RUNNING app BY DEFAULT" + node --max-old-space-size=8192 dist/src/index.js +fi +