I have created a docker image for grails on dockerhub:
It is based on the official openjdk:alpine image
First I run the container:
docker container run -it --rm -p 8080:8080 -p 3000:3000 dhobdensa/docker-alpine-grails
Then I create a new grails app with the vue profile
grails create-app --inplace --profile vue
And then I run the app:
./gradlew bootRun -parallel
Which starts a grails REST API server, and a vue client app using vue-cli and webpack
The server says your app is running on localhost:8080. This can be accessed and returns the expected result.
The client says your app is running on localhost:3000. But when attempting to access this, the browser just shows the default ERR_EMPTY_RESPONSE page.
I have tried different browsers and clearing caches.
Any ideas why accessing port 3000 is not working, but 8080 is?
Additional info
It seems that gradle is essentially running this command:
webpack-dev-server --inline --progress --config build/webpack.dev.conf.js
And this is the file:
https://gist.github.com/dhobdensa/4e22a188cc2b26cf5b0dd4028755d39b
Perhaps this is linked to webpack dev server?
So I found my answer.
I suspected that webpack dev server was the place to be looking.
Then I found this issue on github:
Cant run webpack-dev-server inside of a docker container?
https://github.com/webpack/webpack-dev-server/issues/547
Long story short, I had to add --host 0.0.0.0 to the "dev" task in package.json
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js --host 0.0.0.0"