From 67a59b554da29de716aa7cd9324873db0808ee0c Mon Sep 17 00:00:00 2001 From: "Nikolai X. Shadeuxs" Date: Wed, 19 Jun 2024 04:15:45 -0400 Subject: [PATCH] Update apps/api/Dockerfile --- apps/api/Dockerfile | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/apps/api/Dockerfile b/apps/api/Dockerfile index fb20c1d..1871a52 100644 --- a/apps/api/Dockerfile +++ b/apps/api/Dockerfile @@ -3,21 +3,21 @@ ENV PNPM_HOME="/pnpm" ENV PATH="$PNPM_HOME:$PATH" LABEL fly_launch_runtime="Node.js" RUN corepack enable +COPY . /app WORKDIR /app FROM base AS prod-deps -COPY /cache /pnpm/store -COPY apps/api/package.json apps/api/pnpm-lock.yaml ./ -RUN pnpm install --prod --frozen-lockfile +RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile FROM base AS build -COPY /cache /pnpm/store -COPY apps/api/package.json apps/api/pnpm-lock.yaml ./ -COPY . . -RUN pnpm install --frozen-lockfile -RUN pnpm run build || { echo 'Build failed'; exit 1; } +RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile + +RUN pnpm install +RUN pnpm run build # Install packages needed for deployment + + FROM base RUN apt-get update -qq && \ apt-get install --no-install-recommends -y chromium chromium-sandbox && \ @@ -25,6 +25,9 @@ RUN apt-get update -qq && \ COPY --from=prod-deps /app/node_modules /app/node_modules COPY --from=build /app /app + + + # Start the server by default, this can be overwritten at runtime EXPOSE 8080 ENV PUPPETEER_EXECUTABLE_PATH="/usr/bin/chromium"