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.
<template>
<h1>Version {{ version }}</h1>
</template>
- 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?
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:
npm install --save dotenv-webpack
.env
file: