wasmerio / wapm-cli

📦 WebAssembly Package Manager (CLI)
https://wapm.io/
MIT License
372 stars 26 forks source link

Suport Alpine, non glibc #112

Open galo opened 5 years ago

galo commented 5 years ago

Summary

Can wasmer/wapm run on Alpine distributions without glibc, so it can be packaged in container such as

FROM alpine:3.8
RUN mkdir -p /home/app
RUN apk --no-cache add curl \
    libc6-compat \
    libstdc++ \
    curl https://get.wasmer.io -sSfL | sh 
RUN wapm install cowsay
CMD [ "wapm ", "run", "cowsay" ]
MarkMcCaskey commented 5 years ago

This is an interesting idea, thanks for suggesting it!

I messed around with this a bit yesterday and ran in to some surprising issues. Here's what I ended up with (working around curl not having -L and the env vars not being set correctly):

FROM alpine:3.9
RUN mkdir -p /home/app
RUN apk --no-cache add curl \
    libc6-compat \
    gcompat \
    libstdc++
RUN curl https://raw.githubusercontent.com/WAFoundation/wasmer/master/install.sh -sf | sh 
ENV WASMER_DIR="/root/.wasmer"
ENV WASMER_CACHE_DIR="/root/.wasmer/cache"
ENV PATH="$WASMER_DIR/bin:$WASMER_DIR/globals/wapm_packages/.bin:$PATH"
RUN wapm install cowsay
CMD [ "wapm ", "run", "cowsay" ]

I don't have the context right now on what we'd have to do to start, or the trade offs of, compiling without glibc in Rust, but it's something we can certainly look into!

To immediately answer your question: it can't right now.

galo commented 5 years ago

Thanks!

hansoksendahl commented 5 years ago

@MarkMcCaskey @syrusakbary Any update on this? It would be really nice to be able to run wasmer in a minimal container.

vezult commented 4 years ago

An update on this would be nice.

With the compat libs suggested above, on alpine 3.11.3, I got:

Error relocating /home/david/.wasmer/bin/wasmer: __snprintf_chk: symbol not found
Error relocating /home/david/.wasmer/bin/wasmer: mallinfo: symbol not found
Error relocating /home/david/.wasmer/bin/wasmer: __fprintf_chk: symbol not found
Error relocating /home/david/.wasmer/bin/wasmer: __vsnprintf_chk: symbol not found
Error relocating /home/david/.wasmer/bin/wasmer: __longjmp_chk: symbol not found
> wasmer was installed, but doesn't seem to be working :(
The command '/bin/sh -c . ~/.profile && /tmp/wasmer-installer.sh' returned a non-zero code: 1
make: *** [Makefile:21: image] Error 1