Comment on Best way to dockerize a static website?
CameronDev@programming.dev 11 months ago
Just go nginx, anything else is faffing about. Busybox may not be security tested, so best to avoid on the internet. Php is pointless when its a static site with no php. Id avoid freenginx until its clear that it is going to be supported. There is nothing wrong with stock nginx, the fork is largely political rather than technical.
Dirk@lemmy.ml 11 months ago
Absolutely, but it has a built-in webserver that can serve static files, too (I constantly use that in my dev environment).
But I guess you’re mostly right about just using Nginx. I already have multiple containers running it, though. Most of them just serving static files.
CameronDev@programming.dev 11 months ago
Having PHP installed is just unnecessary attack surface.
Are you really struggling for space that 50mb matters? An 8gb usb can hold thar 160x?
Dirk@lemmy.ml 11 months ago
Yes! Especially running it’s built-in webserver outside your dev environment. They “advertise” doing so in their Docker packages documentation, though. Every project without PHP is a good project. It’s still an option - at least technically.
In a way, yes. I just want to optimize my stuff as much as possible. No unneeded tools, no overhead, a super clean environment, etc. Firing up another Nginx container just doesn’t feel right anymore. (Even if it seems to be possible to manually “hack” file serving into NPM - which makes it a multi-use container serving various different sites and proxying requests.)
The machine I use as docker host also has a pretty low-end CPU and measly 4 gigabytes of RAM. So every resource not wasted is a good resource.
CameronDev@programming.dev 11 months ago
RAM is not the same as storage, that 50mb docker image isn’t going to require 50mb of ram to run. But don’t let me hold you back from your crusade :D
lemmyvore@feddit.nl 11 months ago
How about Python? You can get an HTTP server going with just
python3 -m http.server
from the dir where the files are. Worth remembering because Python is super common and probably already installed in many places (be it on host or in containers).Dirk@lemmy.ml 11 months ago
I once built a router in Python, but it was annoying. The much I like Python, the much I dislike coding in it. Just firing up a web server with it is no big deal, though.
I was even thinking of node.js, but this comes with a whole different set of issues. It would allow for future extensions of the project on the server-side, though.
lemmyvore@feddit.nl 11 months ago
What do you use for Node containers? I use an Alpine image where I install Node but I’ve been wondering if there’s a better way.