Skip to content

Commit

Permalink
Revise Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
kleisauke committed Jan 18, 2023
1 parent 49e233d commit a23b339
Showing 1 changed file with 35 additions and 19 deletions.
54 changes: 35 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
# https://github.com/emscripten-core/emsdk
FROM docker.io/emscripten/emsdk:3.1.29

ENV RUSTUP_TOOLCHAIN=nightly-2023-01-12
# Path settings
ENV \
RUSTUP_HOME="/usr/local/rustup" \
PATH="/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin:$EMSDK/upstream/emscripten:$EMSDK/upstream/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

ENV PATH=$EMSDK:$EMSDK/upstream/emscripten:$EMSDK/upstream/bin:/root/.rustup/toolchains/$RUSTUP_TOOLCHAIN-x86_64-unknown-linux-gnu/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
# Enable Emscripten sysroot cache
EM_CACHE=/src/build/emcache \
# Enable Rust cache
CARGO_HOME="/src/build/cargo-cache" \
# Enable ccache
CCACHE_DIR=/src/build/ccache \
_EMCC_CCACHE=1
# Cache settings
ENV \
# Enable Emscripten sysroot cache
EM_CACHE="/src/build/emcache" \
# Enable Rust cache
CARGO_HOME="/src/build/cargo-cache" \
# Enable ccache
CCACHE_DIR="/src/build/ccache" \
_EMCC_CCACHE=1

RUN apt-get update \
&& curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - \
&& apt-get install -qqy \
RUN \
apt-get update && \
curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && \
apt-get install -qqy \
autoconf \
build-essential \
ccache \
Expand All @@ -25,14 +30,25 @@ RUN apt-get update \
# needed for Meson
ninja-build \
python3-pip \
&& \
curl https://sh.rustup.rs -sSf | sh -s -- -y \
--no-modify-path \
--profile minimal \
--target wasm32-unknown-emscripten \
--default-toolchain nightly \
--component rust-src \
&& \
# https://github.com/mesonbuild/meson/pull/10969
&& pip3 install git+https://github.com/kleisauke/meson@wasm-vips \
pip3 install git+https://github.com/kleisauke/meson@wasm-vips && \
# Prefer the default system-installed version of Node.js
&& echo "NODE_JS = '$(which node)'" >> $EMSDK/.emscripten
echo "NODE_JS = '$(which node)'" >> $EMSDK/.emscripten

RUN curl -Ls https://github.com/emscripten-core/emscripten/compare/3.1.29...kleisauke:wasm-vips-3.1.29.patch | patch -p1 -d /emsdk/upstream/emscripten && \
curl -Ls https://github.com/emscripten-core/emscripten/compare/3.1.29...kleisauke:dylink-deno-compat.patch | patch -p1 -d /emsdk/upstream/emscripten && \
emcc --clear-cache && embuilder build sysroot --force
# Emscripten patches
RUN \
curl -Ls https://github.com/emscripten-core/emscripten/compare/3.1.29...kleisauke:wasm-vips-3.1.29.patch | patch -p1 -d $EMSDK/upstream/emscripten && \
curl -Ls https://github.com/emscripten-core/emscripten/compare/3.1.29...kleisauke:dylink-deno-compat.patch | patch -p1 -d $EMSDK/upstream/emscripten && \
emcc --clear-cache && embuilder build sysroot --force

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --target wasm32-unknown-emscripten --default-toolchain $RUSTUP_TOOLCHAIN --component rust-src
RUN curl -Ls https://github.com/rust-lang/rust/pull/106779.patch | patch -p1 -d /root/.rustup/toolchains/$RUSTUP_TOOLCHAIN-x86_64-unknown-linux-gnu/lib/rustlib/src/rust
# Rust patches
RUN \
curl -Ls https://github.com/rust-lang/rust/pull/106779.patch | patch -p1 -d $RUSTUP_HOME/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust

0 comments on commit a23b339

Please sign in to comment.