Skip to content

Commit

Permalink
wasm: update image to Ubuntu 20.04. Update runtimes
Browse files Browse the repository at this point in the history
- node 10 -> node 18
- wasmtime v0.8.0-ish -> wasmtime v3.0.0
- wasmer 0.12.0-ish -> wasmer 2.0.0

Also, update ffi-napi to 4.0.3.

Comment out wac/wax/wace build since these don't currently work.
  • Loading branch information
kanaka committed Aug 8, 2024
1 parent dff0977 commit f1d2473
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 56 deletions.
106 changes: 51 additions & 55 deletions impls/wasm/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:18.04 as base
FROM ubuntu:20.04 as base
MAINTAINER Joel Martin <github@martintribe.org>

##########################################################
Expand Down Expand Up @@ -28,9 +28,9 @@ WORKDIR /mal
# For building node modules
RUN apt-get -y install g++

# Add nodesource apt repo config for 10.x stable
# Add nodesource apt repo config for 18.x stable
RUN apt-get -y install gnupg
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash -

# Install nodejs
RUN apt-get -y install nodejs
Expand All @@ -42,22 +42,18 @@ ENV NPM_CONFIG_CACHE /mal/.npm
#
RUN dpkg --add-architecture i386 && \
apt-get -y update && \
apt-get -y install \
lib32gcc-8-dev libsdl2-dev:i386 libsdl2-image-dev:i386 \
libedit-dev:i386 freeglut3-dev:i386 lib32gcc-7-dev \
DEBIAN_FRONTEND=noninteractive apt-get -y install \
lib32gcc-9-dev lib32gcc-8-dev lib32gcc-7-dev \
libsdl2-dev:i386 libsdl2-image-dev:i386 \
libedit-dev:i386 freeglut3-dev:i386 \
libreadline-dev:i386

#
# binaryen
#
RUN apt-get -y install git-core cmake

RUN git clone https://github.com/WebAssembly/binaryen/ && \
cd binaryen && \
cmake . && make && \
make install && \
cd .. && \
rm -r binaryen
RUN apt-get -y install binaryen

###########################################################################
FROM base as build_tools
Expand All @@ -66,37 +62,37 @@ FROM base as build_tools
#
# clang/LLVM and rust (for building wasmtime)
#
RUN apt-get -y install llvm-3.9-dev libclang-3.9-dev clang-3.9
RUN apt-get -y install curl && \
curl https://sh.rustup.rs -sSf > /tmp/rustup.sh && \
sh /tmp/rustup.sh -y
ENV PATH $PATH:/root/.cargo/bin
#RUN apt-get -y install llvm-3.9-dev libclang-3.9-dev clang-3.9
#RUN apt-get -y install curl && \
# curl https://sh.rustup.rs -sSf > /tmp/rustup.sh && \
# sh /tmp/rustup.sh -y
#ENV PATH $PATH:/root/.cargo/bin

#
# pypy / rpython (for building warpy)
#

# rpython deps
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get -y install libffi-dev pkg-config libz-dev \
libbz2-dev libsqlite3-dev libncurses-dev libexpat1-dev \
libssl-dev libgdbm-dev tcl-dev

# install pypy, build and install pypy/rpython, remove prior pypy
RUN apt-get -y install software-properties-common && \
add-apt-repository ppa:pypy && \
apt-get -y update && \
apt-get -y install pypy && \
mkdir -p /opt/pypy && \
curl -L https://bitbucket.org/pypy/pypy/downloads/pypy2-v6.0.0-src.tar.bz2 \
| tar -xjf - -C /opt/pypy/ --strip-components=1 && \
cd /opt/pypy && make && \
chmod -R ugo+rw /opt/pypy/rpython/_cache && \
ln -sf /opt/pypy/rpython/bin/rpython /usr/local/bin/rpython && \
ln -sf /opt/pypy/pypy-c /usr/local/bin/pypy && \
rm -rf /tmp/usession* && \
ln -sf /opt/pypy/pypy/goal/pypy-c /usr/local/bin/pypy && \
apt-get -y autoremove pypy
## rpython deps
#ENV DEBIAN_FRONTEND=noninteractive
#RUN apt-get -y install libffi-dev pkg-config libz-dev \
# libbz2-dev libsqlite3-dev libncurses-dev libexpat1-dev \
# libssl-dev libgdbm-dev tcl-dev
#
## install pypy, build and install pypy/rpython, remove prior pypy
#RUN apt-get -y install software-properties-common && \
# add-apt-repository ppa:pypy && \
# apt-get -y update && \
# apt-get -y install pypy && \
# mkdir -p /opt/pypy && \
# curl -L https://github.com/pypy/pypy/archive/refs/tags/release-pypy2.7-v6.0.0.tar.gz \
# | tar -xzf - -C /opt/pypy/ --strip-components=1 && \
# cd /opt/pypy && make && \
# chmod -R ugo+rw /opt/pypy/rpython/_cache && \
# ln -sf /opt/pypy/rpython/bin/rpython /usr/local/bin/rpython && \
# ln -sf /opt/pypy/pypy-c /usr/local/bin/pypy && \
# rm -rf /tmp/usession* && \
# ln -sf /opt/pypy/pypy/goal/pypy-c /usr/local/bin/pypy && \
# apt-get -y autoremove pypy


#
Expand Down Expand Up @@ -127,24 +123,25 @@ FROM build_tools as runtimes
#
# warpy
#
RUN git clone https://github.com/kanaka/warpy/ && \
cd warpy && \
make warpy-nojit && \
cp warpy-nojit /usr/bin/warpy
#RUN git clone https://github.com/kanaka/warpy/ && \
# cd warpy && \
# make warpy-nojit && \
# cp warpy-nojit /usr/bin/warpy

#
# wac/wace
#
RUN git clone https://github.com/kanaka/wac/ && \
cd wac && \
make USE_SDL= wac wax wace && \
cp wac wax wace /usr/bin
#RUN git clone https://github.com/kanaka/wac/ && \
# cd wac && \
# make USE_SDL= wac wax wace && \
# cp wac wax wace /usr/bin

#
# wasmer
#

RUN curl https://get.wasmer.io -sSfL | sh && \
#RUN curl https://get.wasmer.io -sSfL | sh
RUN sh -c "$(curl https://get.wasmer.io -sSfL)" -- 2.0.0 && \
cp /root/.wasmer/bin/wasmer /usr/bin/wasmer && \
cp /root/.wasmer/bin/wapm /usr/bin/wapm

Expand All @@ -157,9 +154,8 @@ RUN curl https://get.wasmer.io -sSfL | sh && \
# wasmtime
#

RUN curl -L https://github.com/CraneStation/wasmtime/releases/download/dev/wasmtime-dev-x86_64-linux.tar.xz | tar xvJf - && \
cp wasmtime-dev-x86_64-linux/wasmtime /usr/bin/wasmtime && \
cp wasmtime-dev-x86_64-linux/wasm2obj /usr/bin/wasm2obj
RUN curl -L https://github.com/bytecodealliance/wasmtime/releases/download/v3.0.0/wasmtime-v3.0.0-x86_64-linux.tar.xz | tar xvJf - && \
cp wasmtime-v3.0.0-x86_64-linux/wasmtime /usr/bin/wasmtime

#RUN git clone --recursive https://github.com/CraneStation/wasmtime && \
# cd wasmtime && \
Expand All @@ -173,13 +169,13 @@ RUN curl -L https://github.com/CraneStation/wasmtime/releases/download/dev/wasmt
FROM base as wasm
###########################################################################

COPY --from=runtimes /usr/bin/wac /usr/bin/wac
COPY --from=runtimes /usr/bin/wax /usr/bin/wax
COPY --from=runtimes /usr/bin/wace /usr/bin/wace
COPY --from=runtimes /usr/bin/warpy /usr/bin/warpy
#COPY --from=runtimes /usr/bin/wac /usr/bin/wac
#COPY --from=runtimes /usr/bin/wax /usr/bin/wax
#COPY --from=runtimes /usr/bin/wace /usr/bin/wace
#COPY --from=runtimes /usr/bin/warpy /usr/bin/warpy
COPY --from=runtimes /usr/bin/wasmtime /usr/bin/wasmtime
COPY --from=runtimes /usr/bin/wasm2obj /usr/bin/wasm2obj

COPY --from=runtimes /usr/bin/wasmer /usr/bin/wasmer
COPY --from=runtimes /usr/bin/wapm /usr/bin/wapm

ENV HOME /mal
2 changes: 1 addition & 1 deletion impls/wasm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Make a Lisp (mal) language implemented in WebAssembly",
"dependencies": {
"@kanaka/wamp": "1.0.9",
"ffi-napi": "^2.4.4",
"ffi-napi": "^4.0.3",
"text-encoding": "0.6.4"
}
}

0 comments on commit f1d2473

Please sign in to comment.