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

chore(container): Correct webpack binding in container #1023

Merged
merged 1 commit into from
Mar 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Comment out to enable
DEFAULT_HOST=ci.foo.redhat.com
HOT_RELOAD='false'
# WEBPACK_BIND=192.168.0.2

# Enable/uncomment this to run chrome locally
# CHROME_DIR=../insights-chrome
Expand Down
9 changes: 9 additions & 0 deletions config/devserver.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
/* global module */
let default_host;

const bindHost = () => {
if (process.env.IN_DOCKER && typeof(process.env.WEBPACK_BIND) === 'undefined') {
return '0.0.0.0';
} else {
return process.env.WEBPACK_BIND || 'localhost';
}
};

if (process.env.DEFAULT_HOST) {
default_host = process.env.DEFAULT_HOST;
} else {
Expand All @@ -23,6 +31,7 @@ const devserverConfig = {
hot: hotReload(),
injectClient: hotReload(),
inline: hotReload(),
host: bindHost(),
allowedHosts: [
'ci.foo.redhat.com',
'qa.foo.redhat.com',
Expand Down
2 changes: 2 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ if [[ ! -d "/compliance/node_modules/@redhat-cloud-services" ]]; then
cd /compliance; /usr/bin/npm install;
fi

export IN_DOCKER='true';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason the Docker compose documentation is not right. A environment variable defined in the .env file doesn't seem to overwrite the one in the compose file[1].

[1] https://docs.docker.com/compose/environment-variables/


exec "$@"