Alpine Linux in the Browser (2020)
bellard.org
bellard.org
To be fair, I believe Bellard's JS x86 emulator predates this (and WASM, and to my knowledge also possibly emscripten) by several years :) It has a very interesting history itself:
> I wrote the initial version of JSLinux[...] in Javascript
> [...] I modified it to use the asm.js Javascript subset [...]
> [...] so I converted the JSLinux asm.js code to C and converted it back to Javascript with emscripten!
Both versions seem to use the same service.
Related links:
https://github.com/copy/v86/blob/master/docs/networking.md
Network section in https://bellard.org/jslinux/faq.html
"Can I access to the network from the virtual machine ? Yes it is possible. It uses the websocket VPN offered by Benjamin Burns (see his blog[2]). The bandwidth is capped to 40 kB/s and at most two connections are allowed per public IP address. Please don't abuse the service. "
[1] https://bellard.org/jslinux/faq.html [2] http://www.benjamincburns.com/2013/11/10/jor1k-ethmac-suppor...
DNS is comparable to HTTP probably, since you could just use DNS-over-HTTPS and intercept DNS packets.
Why is it noteworthy / in the new page here?
Fabrice seems to know an insane amount about how computers work, knows all the CS stuff, has a tight grasp of all kinds of algorithms, great math intuition, and a lot of time on his hands to write OSS code. I bet he spent a lot of time learning the basics.
https://github.com/emscripten-core/emscripten/graphs/contrib...
and an article from 2012 about using it
https://www.webpronews.com/easily-port-c-to-html5javascript-...
Given some arbitrary metric it's generally not the best to compare yourself with the best of the best (on that metric), just doing the best you can do and striving to learn and improve (and live and be there for your family etc.) is more then good enough.
And of course, he wrote it in plain ANSI C for the efficiency.
I would not at all feel bad about not measuring up anywhere close to Fabrice Bellard. Be happy with what you've done.
If necessary take time away from social media, including HN. Personally I've stopped visiting most social media and simultaneously feel more satisfied, less harried, and also have had more time to accomplish some small personal projects.
Of course one could argue that's mostly Go's fault...
That said, it looks like as of late-2021, at least some projects are offering musllinux wheels as well, per the discussion here: https://github.com/pypa/manylinux/issues/37 (not numpy yet, though: https://pypi.org/project/numpy/#files)
Here's a longer version of the above, originally published in 2020, but with an update regarding PEP 656: https://pythonspeed.com/articles/alpine-docker-python/
the Node 19 release alpine image is ~175mb, the same release on debian (bullseye) is roughly 1gb (998mb). Still ~80MB smaller than the bullseye-slim release (247mb).
---
That said - if the ask was for using it as a daily driver on a machine (primary OS), I'd probably still pick a more fully featured distro (ex: my daily driver is Arch, not Alpine). The available packages and tooling in Alpine aren't really geared towards daily use as an OS, although some folks definitely do it.
Given the size of Alpine itself (less than 10 MB, last time I checked), is it node that pulls in so much extra stuff, or something else?
Taking a peak at the official dockerfile for alpine node (https://github.com/nodejs/docker-node/blob/28ad5e0e5d0e80df4...), they're also pulling in the following packages
&& apk add --no-cache --virtual .build-deps-full \
binutils-gold \
g++ \
gcc \
gnupg \
libgcc \
linux-headers \
make \
python3
My guess is the most weight is probably coming from linux-headers (~10mb), python3 (~50mb), and nodejs (~60mb). Plus 1 to 10 mb for each of the other pacakges, and you end up right there around 175mb.They also appear to be cleaning them up, so I'm not actually sure where all that extra weight is coming from.
Node itself is fairly trimmed down in the packages for alpine (40MB installed), but they're not using that package, they're pulling in their own version from their download sources - so it's possible they're including a lot of extra junk there. They also add yarn which is another 10mb.
But in general - I agree, there's about 100mb of weight I can't actually explain in that image from a very quick look.
The only issue I've really had is libc vs musl for some of my dependencies.
Its _tiny_ compared to ubuntu.
I haven't looked at daily driving it because it doesn't feel like it's really meant for desktop use (although I'm sure it'll work), Something like arch makes more sense if you want something more lightweight while also having decent documentation and support for desktop use, and better packaging for things like chrome, vscode, etc. Especially because of musl I suspect you'll run into a lot of issues in general.
EDIT: Also most images like python have alpine variants now which is really nice.
You probably don’t want to use Alpine for Python containers. Many packages don’t provide wheels for Alpine (the Python version of prebuilt binaries), so you’ll have to build them from source, countering the space savings.
You’re often better just using something like Debian-slim or something.
Many people use it on desktops. Also many people use postmarketOS (phone-specific packages on top of Alpine repos) on phones.
You would be better trying Xubuntu, MX linux, NixOS...