You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add instructions for building Next.js client with SSG locally in Docker Compose (#1918)
* docs(deployment/docker-compose.md): Add a section Building Next.js client locally with SSG
Added detailed instructions for building a Next.js client with Static Site Generation (SSG) in a Docker Compose environment. The steps include adjustments to the compose.prod.yaml file, starting the php service container, optional creation of a .env file for the Next.js client, building the pwa service, and finally bringing up the full project. This setup ensures the Next.js client can access the API at build time for static page generation.
* docs(create-client/nextjs.md): Generating a production build locally with docker compose
Updated the Next.js documentation to include instructions for generating a production build locally using Docker Compose. The update provides a link to the detailed steps in the Docker Compose deployment guide.
* docs(deployment/kubernetes.ms): Added Docker build command for SSG in Kubernetes doc
Added optional Docker build command for SSG projects in Kubernetes doc. This command allows the PWA to access a locally running API during the build process, useful for generating static pages at build time.
* docs(deployement/docker-compose): add a step to override the php env variables
To ensure TRUSTED_HOSTS and MERCURE_PUBLIC_URL remain valid when altering SERVER_NAME to use an HTTP scheme or include a port, these variables must be overridden. This adjustment accommodates configurations where SERVER_NAME deviates from the standard HTTPS format or includes port specifications.
* docs(deployement/docker-compose): adapt docs for variables update
---------
Co-authored-by: JH <[email protected]>
docker compose -f -compose.yaml -f compose.prod.yaml up --wait
@@ -114,3 +116,66 @@ As a shortcut, `private_ranges` may be configured to trust all private IP ranges
114
116
+ trusted_proxies private_ranges
115
117
+}
116
118
```
119
+
120
+
## Building Next.js client locally with SSG
121
+
122
+
When deploying API Platform with Docker Compose and you need to build a Next.js client that utilizes Static Site Generation (SSG), a specific setup is required.
123
+
This setup ensures the Next.js client can access the API at build time to generate static pages.
124
+
125
+
### Configuration Steps
126
+
127
+
#### 1. Adjust the compose.prod.yaml file
128
+
129
+
Modify the pwa service to ensure network communication between the pwa and php services during the build:
If your are using the [create-client](../create-client/nextjs.md) generator inside your Next.js client, you need to create a `.env` file in the `pwa` directory with the `NEXT_PUBLIC_ENTRYPOINT` environment variable to ensure the Next.js client knows where to find the API:
Optional: If your pwa project use Static Site Generation (SSG) and you need to build it against the API running locally, you can build the pwa with the command below.
0 commit comments