Live data from Hacker News

A tiny Docker image to serve static websites

lipanski.com

131–140 of 156 posts

Re: A tiny Docker image to serve static websites

#131

Earlier quoted context omitted.

Docker adds other value to the lifecycle of your deployment. An "optimization" where you're removing value is just a compromise. Otherwise we'd all run our static sites on UEFI.

What value is that, for running such a simple piece of software?

You can have multiple instances of the server running on the machine without interfering with each other.

You can limit file system access for the server to only a certain folder.

You can similarly limit port access and manage conflicts (e.g. multiple servers can think they are listening on a certain open port but those are mapped to something else on the host).

If you have multiple machines with different operating systems or even architecture you can deploy your server as a container more easily on them without needing to rebuild or test for each one.

You can have the same environment running locally while development or on CI servers without complicated setups.

The system can scale out a lot more easily to hundreds/thousands of machines if you decide to use something like Kubernetes.

Re: A tiny Docker image to serve static websites

#134
Seems pretty silly. That being said, I did the exact same thing a couple years ago for work. My first attempt was to use busybox's built-in httpd, but it didn't support restarts. I vaguely recall settling on the same alpine + thttpd solution. The files being served were large, so the alpine solution was good enough.

Re: A tiny Docker image to serve static websites

#136

Earlier quoted context omitted.

Wanting to own your own web presence is reason not to host them on GitHub. For static websites, CDNs are largely unnecessary. My potato of a website hosted from a computer in my living room has been on the front page of HN several times without as much as increasing its fan speed. It took Elon Musk tweeting a link to one of my blog posts before it started struggling to serve pages. I think it ran out of file descript…

Was it through a VPN? I feel like revealing my home IP to random people on the internet is a bad move.

No VPN. I have the ports fairly well tightened down, though. I'm exposed to a zero-day in iptables itself or something, but whatever. Even if someone got in it would be an inconvenience at worst. It's not like I'm making money off this stuff.

Re: A tiny Docker image to serve static websites

#138

Earlier quoted context omitted.

Docker adds other value to the lifecycle of your deployment. An "optimization" where you're removing value is just a compromise. Otherwise we'd all run our static sites on UEFI.

What value is that, for running such a simple piece of software?

Adding to some of the other responses, one reason I chose to deploy a SPA I'm working on as a Docker image is atomicity - if I want to deploy a newer version I simply switch out the tag in my container orchestrator's config (Nomad in this case, but the same principles apply to k8s and friends) and it's guaranteed that the new deployment will be pristine, without the risk of leftover files from a rsync or similar - and if I need to roll back I do the exact same.

Re: A tiny Docker image to serve static websites

#139

Earlier quoted context omitted.

What value is that, for running such a simple piece of software?

Adding to some of the other responses, one reason I chose to deploy a SPA I'm working on as a Docker image is atomicity - if I want to deploy a newer version I simply switch out the tag in my container orchestrator's config (Nomad in this case, but the same principles apply to k8s and friends) and it's guaranteed that the new deployment will be pristine, without the risk of leftover files from a rsync or similar - an…

There’s value in that, but you don’t need Docker with its related debugging and maintenance overhead to get it. NixOS, among other tools, will do the same thing while constructing a “flat” operating system image.

Anything else, though? There’s got to be more to it than that, or it wouldn’t be as popular as it is.

Post reply on HN