Settings

Theme

Ask HN: How do you serve static files in a Docker container?

3 points by DontBreakAlex 2 years ago · 6 comments · 1 min read


I usually use thttpd in an alpine container. I think I remember seeing a similar server that read files at startup to load them in memory and pre-compress them while running in a from-scratch container, but I can't seem to find it on the internet. What do you guys use ?

stop50 2 years ago

I don't. I serve static files directly from the nginx.

nijave 2 years ago

I'd think given enough memory, your files will cache in memory pretty quickly with any server. I usually just use nginx for these use cases or look to a CDN solution.

brettv2 2 years ago

why wouldn't you just serve them via a CDN?

  • joshxyz 2 years ago

    bunny.net is the cheapest cdn i can recommend if u go this route.

    they give free credits too, and they have tol notch support bunnies.

corytheboyd 2 years ago

+1 for copy files to container, serve with nginx

joshxyz 2 years ago

caddy can serve it, with free tls

if js project i sometimes use npx serve too

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection