# Start from the pre-built Nextjs Base image FROM registry.infra.mintel.me/mintel/nextjs:latest AS builder WORKDIR /app # Ensure we are in a clean, standalone environment RUN rm -rf packages apps pnpm-workspace.yaml 2>/dev/null || true # Build-time environment variables for Next.js ARG NEXT_PUBLIC_BASE_URL ARG UMAMI_API_ENDPOINT ARG NEXT_PUBLIC_TARGET ARG DIRECTUS_URL ARG NPM_TOKEN ENV NEXT_PUBLIC_BASE_URL=$NEXT_PUBLIC_BASE_URL ENV UMAMI_API_ENDPOINT=$UMAMI_API_ENDPOINT ENV NEXT_PUBLIC_TARGET=$NEXT_PUBLIC_TARGET ENV DIRECTUS_URL=$DIRECTUS_URL ENV NPM_TOKEN=$NPM_TOKEN ENV SENTRY_SUPPRESS_TURBOPACK_WARNING=1 ENV SKIP_RUNTIME_ENV_VALIDATION=true # Enable corepack RUN corepack enable # Copy package files COPY package.json pnpm-lock.yaml* .npmrc ./ # Install dependencies RUN pnpm install --no-frozen-lockfile # Copy local files COPY . . # Build the specific application RUN pnpm build # Production runner image FROM registry.infra.mintel.me/mintel/runtime:latest AS runner WORKDIR /app # Copy standalone output and static files COPY --from=builder --chown=nextjs:nodejs /app/public ./public COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static USER nextjs CMD ["node", "server.js"]