Earlier quoted context omitted.
On a second thought, I also don't understand why do npm in two different images, why not just copy the webpack bundles from the builder image into the nginx image ? For me the cause of the big image size was in COPY --from=npmpackages /app /app From your third Dockerfile, it seems replacing the above with the following would have done the trick without adding an extra stage COPY --from=npmpackages /app/_site/ /usr/sh…
I do npm in two different images so that the node_modules can be cached between builds. this massively speeds up my build. The npmpackages layer only installs the npm modules
Shrinking my static site
71–80 of 107 posts
Re: Shrinking my static site
#72Earlier quoted context omitted.
> How is that any different from build tooling for any other language? On the one hand yes, on the other hand it's a large amount of crap just to build a static site. `npm install @11ty/eleventy` pulls 600 packages and yields a 100MB node_modules folder. Even Sphinx (whose scope goes way beyond static site generation) "only" pulls in about 75MB worth of stuff (a third of that being Babel) over two dozen dependencies…
The problem with JS ecosystem is less about size and more about the number of files.
Re: Shrinking my static site
#73Earlier quoted context omitted.
To be honest, GitHub sites have been amazing for me. I just have a simple static website with personal information. HTML and CSS with minimal JS. Purchasing a shared webhost still means extra cost on top of domain registration. With GitHub, I just followed their instructions with my domain, and everything just worked. I'm also not paying anything per month or year besides domain registration which is really nice when…
With GitLab Pages it's even easier, just fork one of the examples in gitlab.com/pages, push a content update in a commit and it's online a minute later thanks to GitLab-CI and GitLab Pages.
Re: Shrinking my static site
#74in my eyes this is all madness. deploying sites via github to some docker shit. how about good old ftp and a cheap shared webhost? like its been done for 30 years.
Re: Shrinking my static site
#75Earlier quoted context omitted.
At work, we build a couple SPA React application for internal tools. All of these SPAs talk to other internal APIs via REST, so you can think of these as static websites. In production, we do exactly what you suggest: serve through a CDN. However, for our dev environments and PR builds, programmatically setting up CDN to handle these use cases is not easily integrated with our CI/CD workflow. Our CI/CD environment is…
Possibly this is far too old fashioned, but all our internal static sites (and a good few external static sites) I deploy to a single Apache server.
I wouldn't suggest moving to docker for this use case, but if everything else was in docker, I'd want this in docker as well, even if that docker container was just running apache.
(Practically, though, if I was starting from scratch, I'd be using NginX.)
Re: Shrinking my static site
#76Re: Shrinking my static site
#77YOU DON'T NEED DOCKER FOR A STATIC SITE. That's why it's called "static". There should be no moving parts in it.
Re: Shrinking my static site
#78I use Hugo as my static site generator, single binary, no dependencies, generating hundreds of pages in milliseconds ... so reading this feels so wrong, I want to call it JavaScript masochism. Taking a simple concept like a static site and adding a ton of complex tooling around it because it is the trend now? Why would you even need a docker image to run a static website? The best thing about a static website us you…
best thing: you could easily pack your static Hugo binary in a container with nothing else. But somehow nobody does this without talking about microkernels (and probably internal google-apps)
Re: Shrinking my static site
#79Earlier quoted context omitted.
At work, we build a couple SPA React application for internal tools. All of these SPAs talk to other internal APIs via REST, so you can think of these as static websites. In production, we do exactly what you suggest: serve through a CDN. However, for our dev environments and PR builds, programmatically setting up CDN to handle these use cases is not easily integrated with our CI/CD workflow. Our CI/CD environment is…
Possibly this is far too old fashioned, but all our internal static sites (and a good few external static sites) I deploy to a single Apache server.
Re: Shrinking my static site
#80YOU DON'T NEED DOCKER FOR A STATIC SITE. That's why it's called "static". There should be no moving parts in it.