Comment on Best way to dockerize a static website?

lemmyvore@feddit.nl ⁨11⁩ ⁨months⁩ ago

I see from your other comments that you’re already running nginx in other containers. The simplest solution would be to make use of one of them. Zero overhead since you’re not adding any new container. 🙂

You mentioned you’re using NPM, well NPM already has a built-in nginx host that you can reach by making a proxy host pointed at 127.0.0.1:80 and adding the following to the “Advanced” tab:

location / {
  root /data/nginx/local_static;
  index index.html;
}

Replace the root location with whatever dir you want, use a volume option on the NPM container to map the dir to the host, put your files in there and that’s it.

source
Sort:hotnewtop