How to expose build time enviromental variables

1

I'm building a full stack application with Next.js framework and want to deploy it to App Runner. How ever Next.js needs to have enviromental variables (secrets) on build time, otherwise build fails. This is stated clearly on Next.js documentation. How ever it seems that in App Runner I'm only able to expose environmental variables on runtime. Is there any way to get secrets from secret manager and set env values on build time? I do not wish to have my ens on client side so NEXT_PUBLIC_ prefix is not a solution around this.

I'm using apprunner.yml config file and deploy automatically from Github repository.

Here is my apprunner.yml config file content:

version: 1.0 runtime: nodejs16 build: commands: build: - yarn --production - yarn build run: command: yarn start network: port: 3000 env: - name: PRIMARY_DB_NAME value: "primary" secrets: - name: DB_URI value-from: "arn:here"

  • Having the same issue. Is this is a case of having to utilize ECR to have more flexibility over the dockerfile?

preguntada hace un año126 visualizaciones
No hay respuestas

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas