Comment on Best way to dockerize a static website?
CameronDev@programming.dev 8 months agoHaving PHP installed is just unnecessary attack surface.
Are you really struggling for space that 50mb matters? An 8gb usb can hold thar 160x?
Comment on Best way to dockerize a static website?
CameronDev@programming.dev 8 months agoHaving 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 8 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 8 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
Dirk@lemmy.ml 8 months ago
Thanks for educating me on basic computer knowledge! 🤣
Applications need RAM, though. A full-fledged webserver with all the bells and whistles likely needs more ram than a specialized single-binary static file delivery server.
CameronDev@programming.dev 8 months ago
Sorry, wasn’t meant to be condescending, you just seem fixated on file size when it sounds like RAM (and/or CPU?) is what you really want to optimise for? I was just pointing out that they arent necessarily correlated to docker image size.
If you really want to cut down your cpu and ram, and are okay with very limited functionality, you could probably write your own webserver to serve static files? Plain http is not hard. But you’d want to steer clear of python and node, as they drag in the whole interpreter overhead.