Skip to content

Instantly share code, notes, and snippets.

@reinhrst
Created November 4, 2023 04:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reinhrst/84b9e20a8a68bcd0e3a48065fc2b9bf3 to your computer and use it in GitHub Desktop.
Save reinhrst/84b9e20a8a68bcd0e3a48065fc2b9bf3 to your computer and use it in GitHub Desktop.
emscripten for arm64 / aarch64 Docker container

This dockerfile builds a docker container similar to https://hub.docker.com/r/emscripten/emsdk, for AMR64. It was tested on a Macbook M2, but I see no reason why it wouldn't work for other arm 64 platforms.

It used the pre-build arm64 emscripten binary mentioned in emscripten-core/emsdk#547 (comment).

Building time is short (mostly downloading stuff); less than 2 minutes on my M2 / 1Gbps internet.

Performance difference is enourmous; Running amd64 images (through Lima/Vz,, with --platform=amd64), building libav.js took almost an hour. With native arm64, it takes around 8 minutes, so about 7 times as fast.

FROM debian
RUN apt-get update && apt-get install -y git xz-utils python3 curl && rm -rf /var/lib/apt/lists/*
RUN git clone https://github.com/emscripten-core/emsdk.git && cd /emsdk && ./emsdk install latest-arm64-linux && ./emsdk activate latest-arm64-linux
ENTRYPOINT ["/emsdk/docker/entrypoint.sh"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment