Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should next-runtime-env work with Docker and docker-compose? #40

Closed
YerayAlonso opened this issue May 31, 2023 · 2 comments
Closed

Should next-runtime-env work with Docker and docker-compose? #40

YerayAlonso opened this issue May 31, 2023 · 2 comments

Comments

@YerayAlonso
Copy link

YerayAlonso commented May 31, 2023

I've tested the package and it works wonderfully in the examples you provide 🎉.
However, I fail to make it work with Docker and Docker Compose 🥀.

The idea would be to define the variables in a .env next to the docker.compose.yml, not next to the nextjs project. Then, pass the variables to the container at the startup.

I've prepared an example here.
I get undefined at the client side.
Note the __ENV.js file is present, but empty (window.__ENV = {}).

@YerayAlonso
Copy link
Author

Solved using a Dockerfile without multistage.

@tom-searle
Copy link

Just to add for anyone that stumbles across this that I was also able to solve this issue by using a Dockerfile without multistage 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants