Skip to content

Make images smaller using best-in-class codecs, right in the browser.

JavaScript

Switch to prebuilt WABT and wasm-pack

Ingvar Stepanyanb8f801333d68
diff --git a/codecs/hqx/Dockerfile b/codecs/hqx/Dockerfile
index 47a13318..54c29ea2 100644
--- a/codecs/hqx/Dockerfile
+++ b/codecs/hqx/Dockerfile
@@ -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
-RUN rustup target add wasm32-unknown-unknown && \
- cargo install wasm-pack
+RUN rustup target add wasm32-unknown-unknown
+RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
-COPY --from=0 /opt/wabt /opt/wabt
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
-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
diff --git a/codecs/hqx/pkg/squooshhqx_bg.wasm b/codecs/hqx/pkg/squooshhqx_bg.wasm
index c5d4857b..93f5be74 100644
Binary files a/codecs/hqx/pkg/squooshhqx_bg.wasm and b/codecs/hqx/pkg/squooshhqx_bg.wasm differ
diff --git a/codecs/resize/Dockerfile b/codecs/resize/Dockerfile
index af9dcc32..4d58a71f 100644
--- a/codecs/resize/Dockerfile
+++ b/codecs/resize/Dockerfile
@@ -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
-RUN rustup target add wasm32-unknown-unknown && \
- cargo install wasm-pack
+RUN rustup target add wasm32-unknown-unknown
+RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
+
+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
-COPY --from=0 /opt/wabt /opt/wabt
-ENV PATH="/opt/wabt/bin:${PATH}"
+ENV PATH="/opt/wabt:${PATH}"
WORKDIR /src
diff --git a/codecs/resize/pkg/resize_bg.wasm b/codecs/resize/pkg/resize_bg.wasm
index 50fc8dc9..c54e145b 100644
Binary files a/codecs/resize/pkg/resize_bg.wasm and b/codecs/resize/pkg/resize_bg.wasm differ
diff --git a/codecs/rotate/Dockerfile b/codecs/rotate/Dockerfile
index 103ca5a3..30b9f7ce 100644
--- a/codecs/rotate/Dockerfile
+++ b/codecs/rotate/Dockerfile
@@ -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
RUN rustup target add wasm32-unknown-unknown
-COPY --from=0 /opt/wabt /opt/wabt
-ENV PATH="/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/wabt:${PATH}"
WORKDIR /src