FROM node:20-slim AS base # Install dependencies only when needed FROM base AS deps RUN corepack enable FROM deps AS build ARG NEXT_PUBLIC_SITE_URL=https://futureporn.net ARG NEXT_PUBLIC_STRAPI_URL=https://portal.futureporn.net ARG NEXT_PUBLIC_UPPY_COMPANION_URL=https://uppy.futureporn.net ENV NEXT_PUBLIC_SITE_URL ${NEXT_PUBLIC_SITE_URL} ENV NEXT_PUBLIC_STRAPI_URL ${NEXT_PUBLIC_STRAPI_URL} ENV NEXT_PUBLIC_UPPY_COMPANION_URL ${NEXT_PUBLIC_UPPY_COMPANION_URL} WORKDIR /usr/src/app COPY . . ENV NEXT_TELEMETRY_DISABLED 1 RUN --mount=type=cache,id=pnpm-store,target=/root/.pnpm-store pnpm install RUN pnpm run -r build RUN pnpm deploy --filter=fp-next /app FROM deps AS dev WORKDIR /app COPY --from=build /usr/src/app /app CMD ["pnpm", "run", "dev"] FROM deps AS next WORKDIR /app COPY --from=build /app /app CMD ["pnpm", "start"]