By ronaldl93
I built a docker container with a NextJS app, using nginx as reverse proxy as we need it for advanced setups like proxy pass, etc.
It gets data from a headless CMS. It works fine locally.
However, when building it on DO App Platform, it’s fails cause it doesn’t detect the Environment Variables, even though I’ve set it up in the application container settings.
Is there a specific way I need to deploy it to take the Env Vars into account?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hello, we may need more details to be able to help… But one thing to note is that environment variables are only available as build-args for Dockerfile builds in App Platform. So you should declare them in the Dockerfile as an ARG and then set the ENV variable in the Dockerfile from the build-arg.
If for example you set MY_ENV_VAR env var in application spec file or via App Platform UI, then something like this may work to actually pass that value into the container:
ARG MY_ENV_VAR
ENV MY_ENV_VAR=${MY_ENV_VAR}
Hope this helps.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.
