Switch to prebuilt WABT and wasm-pack

Significantly speeds up `npm run build:image` commands (as they don't need to compile anything anymore) and slightly reduces size of Docker images:
 - `squoosh-rotate`: 1.87GB -> 1.84GB
 - `squoosh-resize`: 2.02GB -> 1.85GB
 - `squoosh-hqx`: 2.06GB -> 1.9GB
This commit is contained in:
Ingvar Stepanyan
2019-08-02 16:32:13 +01:00
parent 499956e216
commit b8f801333d
5 changed files with 17 additions and 41 deletions

View File

@@ -1,20 +1,12 @@
FROM ubuntu
RUN apt-get update && \
apt-get install -qqy git build-essential cmake python2.7
RUN git clone --depth 1 --recursive https://github.com/WebAssembly/wabt /usr/src/wabt
RUN mkdir -p /usr/src/wabt/build
WORKDIR /usr/src/wabt/build
RUN cmake .. -DCMAKE_INSTALL_PREFIX=/opt/wabt && \
make && \
make install
FROM rust FROM rust
RUN rustup target add wasm32-unknown-unknown && \ RUN rustup target add wasm32-unknown-unknown
cargo install wasm-pack RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
COPY --from=0 /opt/wabt /opt/wabt
RUN mkdir /opt/binaryen && \ RUN mkdir /opt/binaryen && \
curl -L https://github.com/WebAssembly/binaryen/releases/download/1.38.32/binaryen-1.38.32-x86-linux.tar.gz | tar -xzf - -C /opt/binaryen --strip 1 curl -L https://github.com/WebAssembly/binaryen/releases/download/1.38.32/binaryen-1.38.32-x86-linux.tar.gz | tar -xzf - -C /opt/binaryen --strip 1
ENV PATH="/opt/binaryen:/opt/wabt/bin:${PATH}"
RUN mkdir /opt/wabt && \
curl -L https://github.com/WebAssembly/wabt/releases/download/1.0.11/wabt-1.0.11-linux.tar.gz | tar -xzf - -C /opt/wabt --strip 1
ENV PATH="/opt/binaryen:/opt/wabt:${PATH}"
WORKDIR /src WORKDIR /src

Binary file not shown.

View File

@@ -1,17 +1,9 @@
FROM ubuntu
RUN apt-get update && \
apt-get install -qqy git build-essential cmake python2.7
RUN git clone --recursive https://github.com/WebAssembly/wabt /usr/src/wabt
RUN mkdir -p /usr/src/wabt/build
WORKDIR /usr/src/wabt/build
RUN cmake .. -DCMAKE_INSTALL_PREFIX=/opt/wabt && \
make && \
make install
FROM rust FROM rust
RUN rustup target add wasm32-unknown-unknown && \ RUN rustup target add wasm32-unknown-unknown
cargo install wasm-pack RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
COPY --from=0 /opt/wabt /opt/wabt RUN mkdir /opt/wabt && \
ENV PATH="/opt/wabt/bin:${PATH}" curl -L https://github.com/WebAssembly/wabt/releases/download/1.0.11/wabt-1.0.11-linux.tar.gz | tar -xzf - -C /opt/wabt --strip 1
ENV PATH="/opt/wabt:${PATH}"
WORKDIR /src WORKDIR /src

Binary file not shown.

View File

@@ -1,16 +1,8 @@
FROM ubuntu
RUN apt-get update && \
apt-get install -qqy git build-essential cmake python2.7
RUN git clone --recursive https://github.com/WebAssembly/wabt /usr/src/wabt
RUN mkdir -p /usr/src/wabt/build
WORKDIR /usr/src/wabt/build
RUN cmake .. -DCMAKE_INSTALL_PREFIX=/opt/wabt && \
make && \
make install
FROM rust FROM rust
RUN rustup target add wasm32-unknown-unknown RUN rustup target add wasm32-unknown-unknown
COPY --from=0 /opt/wabt /opt/wabt RUN mkdir /opt/wabt && \
ENV PATH="/opt/wabt/bin:${PATH}" curl -L https://github.com/WebAssembly/wabt/releases/download/1.0.11/wabt-1.0.11-linux.tar.gz | tar -xzf - -C /opt/wabt --strip 1
ENV PATH="/opt/wabt:${PATH}"
WORKDIR /src WORKDIR /src