Skip to content

Commit

Permalink
Fix demo development inside a dev container
Browse files Browse the repository at this point in the history
  • Loading branch information
balloob committed Jul 3, 2024
1 parent 19ee150 commit a336dbc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"postCreateCommand": "sudo apt update && sudo apt upgrade -y && sudo apt install -y libpcap-dev",
"postStartCommand": "script/bootstrap",
"containerEnv": {
"DEV_CONTAINER": "1",
"WORKSPACE_DIRECTORY": "${containerWorkspaceFolder}"
},
"customizations": {
Expand Down
3 changes: 3 additions & 0 deletions build-scripts/env.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,7 @@ module.exports = {
}
return version[1];
},
isDevContainer() {
return process.env.DEV_CONTAINER === "1";
},
};
6 changes: 5 additions & 1 deletion build-scripts/gulp/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ const runDevServer = async ({
compiler,
contentBase,
port,
listenHost = "localhost",
listenHost = undefined,
}) => {
if (listenHost === undefined) {
// For dev container, we need to listen on all hosts
listenHost = env.isDevContainer() ? "0.0.0.0" : "localhost";
}
const server = new WebpackDevServer(
{
hot: false,
Expand Down

0 comments on commit a336dbc

Please sign in to comment.