lighthouse-ci icon indicating copy to clipboard operation
lighthouse-ci copied to clipboard

Add ability to run server in Docker with a custom config

Open DeniDoman opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. I want to use your Docker image for lhci-server, but I can't find a way to use my custom configuration file. The config file is hardcoded in a package.json file:

  "scripts": {
    "start": "lhci server --config=./lighthouserc.json"
  },

Describe the solution you'd like Solution is pretty simple - use environment variable to allow user to set a path to the configuration file, with a fallback to the default one:

  "scripts": {
    "start": "lhci server --config=${CONFIG_PATH:-./lighthouserc.json}"
  }

It allow to run Docker container in the following way:

docker container run -e CONFIG_PATH=/data/lighthouserc.json -p 9001:9001 -v lhci-data:/data' -d patrickhulce/lhci-server

Describe alternatives you've considered There is a workaround with Environment variables, but when you need to setup more than 5 - it became messy.

DeniDoman avatar Mar 18 '23 18:03 DeniDoman

If you ok with it - I'll raise a PR. My only concern with the proposed solution - is a compatibility with different operation systems, I'm not a very experienced here.

DeniDoman avatar Mar 18 '23 18:03 DeniDoman