diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d8ef081..4a1dbc6 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -124,6 +124,17 @@ jobs: SENTRY_ORG: ${{ secrets.SENTRY_ORG }} SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} SENTRY_RELEASE_UPLOAD: true + # [WORKAROUND] When building Next.js in a standalone mode the frontend `NEXT_PUBLIC_*` environement variables are hardcoded + # So they are not switchable at runtime. Since ours won't change overtime, we are fine to retrigger a build in needed + # but it would be painful for someone reusing directly the Docker image. Some workarounds exist but they are by far too hacky, see: + # - https://github.com/vercel/next.js/discussions/17641 + # - https://phase.dev/blog/nextjs-public-runtime-variables/ + # - https://www.tomoliver.net/posts/nextjs-docker-public-env-vars + NEXT_PUBLIC_APP_BASE_URL: ${{ secrets.NEXT_PUBLIC_APP_BASE_URL }} + NEXT_PUBLIC_CRISP_WEBSITE_ID: ${{ secrets.NEXT_PUBLIC_CRISP_WEBSITE_ID }} + NEXT_PUBLIC_MATOMO_SITE_ID: ${{ secrets.NEXT_PUBLIC_MATOMO_SITE_ID }} + NEXT_PUBLIC_MATOMO_URL: ${{ secrets.NEXT_PUBLIC_MATOMO_URL }} + NEXT_PUBLIC_SENTRY_DSN: ${{ secrets.NEXT_PUBLIC_SENTRY_DSN }} run: make build - name: Test end-to-end diff --git a/README.md b/README.md index 84310a4..6e5464e 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,8 @@ The following ones must be repository secrets (not environment ones): - `SENTRY_ORG`: [SECRET] - `SENTRY_PROJECT`: [SECRET] +**IMPORTANT: When building Next.js in a standalone mode the frontend `NEXT_PUBLIC_*` environement variables are hardcoded. It means you have to set all of them here too. This is a workaround but we have no simple other choice as of today. For more information have a look at the build step comment into `.github/workflows/ci.yml`.** + #### Default branch The default branch is `main`. @@ -198,6 +200,8 @@ For each build and runtime (since they are shared), you should have set some env - `NEXT_PUBLIC_MATOMO_SITE_ID`: [GENERATED] _(format `https://xxx.yyy.zzz/`)_ - `MISTRAL_API_KEY`: [SECRET] _(you can create an API key from your MistralAI "La plateforme" account)_ +**IMPORTANT: When building Next.js in a standalone mode the frontend `NEXT_PUBLIC_*` environement variables are hardcoded. It means you have to set them into the build environment too. For more information have a look at the build step comment into `.github/workflows/ci.yml`.** + _Note: `OPENAI_API_KEY` variable can be found in the code even if not used in production. It remains for comparing purposes, but also as a legacy since the proof of concept of Établi was based on GPT models._ #### Monitoring