From aa1e820d525334f7a44f40076eac7d999f08eb1d Mon Sep 17 00:00:00 2001 From: Nick Roth Date: Wed, 5 Feb 2025 03:19:11 -0600 Subject: [PATCH] Fix corepack and self hosting setup (#1131) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update Dockerfile Config corepack and pnpm * Update Dockerfile Try using this approach: https://github.com/pnpm/pnpm/issues/9029#issuecomment-2631400936 * Add ulimits command to docker compose * Remove ulimit from entrypoint * Add ulimit back to docker-entrypoint.sh This implements the proposed approach to not fail when the ulimit command can't run due to the environment * Resolve signature mismatch Resolves issue encountered when using docker compose up on a clean environment on an intel mac. This just adds the clean command to avoid leveraging any cached data before updating apt-get and installing ca-certificates --------- Co-authored-by: Nick Roth Co-authored-by: Gergő Móricz --- apps/api/Dockerfile | 5 +++-- apps/api/docker-entrypoint.sh | 2 ++ docker-compose.yaml | 4 ++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/api/Dockerfile b/apps/api/Dockerfile index af86e904..c0bdbb58 100644 --- a/apps/api/Dockerfile +++ b/apps/api/Dockerfile @@ -1,4 +1,5 @@ FROM node:20-slim AS base + ENV PNPM_HOME="/pnpm" ENV PATH="$PNPM_HOME:$PATH" LABEL fly_launch_runtime="Node.js" @@ -16,7 +17,7 @@ RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-l FROM base AS build RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile -RUN apt-get update -qq && apt-get install -y ca-certificates && update-ca-certificates +RUN apt-get clean && apt-get update -qq && apt-get install -y ca-certificates && update-ca-certificates RUN pnpm install RUN --mount=type=secret,id=SENTRY_AUTH_TOKEN \ bash -c 'export SENTRY_AUTH_TOKEN="$(cat /run/secrets/SENTRY_AUTH_TOKEN)"; if [ -z $SENTRY_AUTH_TOKEN ]; then pnpm run build:nosentry; else pnpm run build; fi' @@ -53,4 +54,4 @@ ENV PUPPETEER_EXECUTABLE_PATH="/usr/bin/chromium" # Make sure the entrypoint script has the correct line endings RUN sed -i 's/\r$//' /app/docker-entrypoint.sh -ENTRYPOINT "/app/docker-entrypoint.sh" \ No newline at end of file +ENTRYPOINT "/app/docker-entrypoint.sh" diff --git a/apps/api/docker-entrypoint.sh b/apps/api/docker-entrypoint.sh index a8bd3e2a..0e8d72bb 100755 --- a/apps/api/docker-entrypoint.sh +++ b/apps/api/docker-entrypoint.sh @@ -1,8 +1,10 @@ #!/bin/bash -e if [ $UID -eq 0 ]; then + set +e # disable failing on errror ulimit -n 65535 echo "NEW ULIMIT: $(ulimit -n)" + set -e # enable failing on error else echo ENTRYPOINT DID NOT RUN AS ROOT fi diff --git a/docker-compose.yaml b/docker-compose.yaml index 24c007c2..6594fb9e 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -2,6 +2,10 @@ name: firecrawl x-common-service: &common-service build: apps/api + ulimits: + nofile: + soft: 65535 + hard: 65535 networks: - backend extra_hosts: