-
-
Notifications
You must be signed in to change notification settings - Fork 33
How can set a client config through Dockerfile #208
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
Comments
Try something like dotenv-webpack. This works with both dotenv file and global variables (with docker). |
You can also just have a pre-made config file and copy this into your docker image, or set up a dotenv file before building in the dockerfile. |
Actually we need to pass the value from For example if we config webpack plugins as below:
The value is not known in this // ./client.env
SESSION_EXPIRY_TIMEOUT= process.env.my_yml_env
|
I think there might be an issue with the Webpack version. Did a quick test, and I had to do the following. My variable was now exposed to the client on build time and was resolved correctly. # docker-compose.yaml
version: '3'
services:
osjs:
user: node
build:
context: .
volumes:
- .:/usr/src/osjs
ports:
- "${OSJS_NODE_PORT:-8000}:8000"
environment:
- MY_VARIABLE=foo // webpack.config.js
//...
module.exports = {
plugins: [
// ...
// Standard env variables + explicitly the ones I want
new webpack.EnvironmentPlugin(['NODE_ENV', 'DEBUG', 'MY_VARIABLE']),
// ...
]
} // config.js
export default {
myVariable: process.env.MY_VARIABLE, // = "foo"
auth: {
login: {
username: 'demo',
password: 'demo'
}
}
}; |
Many Thanks |
Closing because this should be resolved. |
Uh oh!
There was an error while loading. Please reload this page.
How can I set a client config through Dockerfile or docker compose file?
According to the description in the Docker document, we should be able to define a runtime variable using ENV in the Docker file.
Dockerfile
Also, according to Osjs document , we should be able to use this parameter in the client configuration.
src/client/config.js
But unfortunately I get undefined value in client in such situation.
@andersevenrud
@ajmeese7
The text was updated successfully, but these errors were encountered: