ZHAW-PM4-Compass / compass

A time-, mood- and incident tracking application for Stadtmuur called Compass 🧭
https://stadtmuur.ch/
MIT License
0 stars 0 forks source link

Environmental Variables during runtime NEXT.JS #50

Closed r44cx closed 3 months ago

r44cx commented 4 months ago

We will come up with a solution to this problem. As the env resolve is happening during build and not runtime. But we don't want to build the app during container startup or include it into the docker image.

r44cx commented 3 months ago

Option 1: Server Action Option 2: SSR for Frontend Option 3: Build on Deployment Option 4: Dockerfile:

...
CMD ["/start.sh"]

start.sh:

sed -i "s/PLACEHOLDER_ENV/${MY_ENV_VAR}/g" /app/.next/static/*.js
npm run start

The order of the options also represents my preference for the solution.

r44cx commented 3 months ago

We go with Option 1. Server Action