Best rendering method Next.js + Prismic in Docker CI/CD Setup?

I’m a backend developer and relatively new to Next.js. I’m working on a Next.js project and using Prismic as my CMS. After reviewing the Prismic documentation, I noticed they recommend using Static Rendering (SSG) for fetching data. However, I’m struggling to understand how this fits within my CI/CD pipeline, especially regarding data fetching during build time.

My main concern is about the reliability and performance of fetching data from Prismic during the build step in my pipeline. I’m using Docker to build the app and create a Docker image which is then deployed to my EC2 instance. Traditionally, I’ve been cautious about making requests to external resources during the build stage due to potential issues (like the service not being available), build times and reliability (if the service is failing then my build will fail as well).

Given my setup, I’m trying to determine the best rendering technique to use: SSG, SSR, or ISR.

  • Is it common practice to fetch data from a CMS like Prismic (or any other external service) during the build step in a CI/CD pipeline if I want to use SSG?

  • How does fetching data from Prismic or any other external service like my Spring Boot API during build time affect the reliability and performance of the CI/CD pipeline?

I found this GitHub discussion where they comment about similar issues with fetching data during build time. They talk about some of the concerns I have, such as the impact of network requests during the build process and one suggestion is to use a user-defined environment variable to skip pre-rendering pages during build time which apparently goes against what Prismic suggest in their documentation.

Appreciate any advice from those who have experience with Next.js and Prismic or with similar setups.

Thanks in advance!