TrilonIO / aspnetcore-Vue-starter

*NEW* Asp.net Core & Vue.js (ES6) SPA Starter kit - Vuex, webpack, Web API, Docker, and more! By @TrilonIO
https://www.trilon.io
MIT License
1.22k stars 266 forks source link

Environment Variables not passed to vue.js #141

Closed asawatzki closed 4 years ago

asawatzki commented 4 years ago

I'm trying to use environment variables in vue.js in docker production mode. The container knows about the variables, process.env.VUE_APP_MY_VAR in vue.js does not.

What have I done:


- build and run docker: `docker build -t myapp:latest . && docker run -it -d --rm -p 8080:80 --name myapp myapp:latest`

Behavior:
App starts as usual but the content of VUE_APP_MY_VAR is not displayed.
docker exec -it myapp echo $VUE_APP_MY_VAR shows the expexted value.

Expectation:
App should also show the value of VUE_APP_MY_VAR.

What am I missing? Do you have some adivice?
asawatzki commented 4 years ago

I solved this!

For others with similar problems: remove the .env entry in .dockerignore.