liuweiGL / vite-plugin-mkcert

Provide certificates for vite's https dev service.
https://www.npmjs.com/package/vite-plugin-mkcert
MIT License
584 stars 37 forks source link

Running inside docker container #78

Open Shujee opened 9 months ago

Shujee commented 9 months ago

Is this plug-in supposed to work in a docker container too?

  1. How should my vite.config.ts look like?
  2. Also what port(s) should I map in my docker-compose file?
  3. Is server.hmr option required/preferred in this scenario?

I have been struggling with it for several hours. In the best case scenario I was getting NET::ERR_CERT_AUTHORITY_INVALID in the browser when trying to access vite dev server.

In the current setup, I am:

  1. Using -- host option with the dev script.
  2. Running vite server on port 3000.
  3. Mapping port 3000 to 3005 of the host machine in my docker-compose file

But I cannot access the Vite server in a host browser using any of 127.0.0.1, localhost and 0.0.0.0.

liuweiGL commented 9 months ago

I'm sorry, I'm not very familiar with Docker