wapm-cli icon indicating copy to clipboard operation
wapm-cli copied to clipboard

Suport Alpine, non glibc

Open galo opened this issue 5 years ago • 4 comments

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" ]

galo avatar May 20 '19 17:05 galo

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.

MarkMcCaskey avatar May 21 '19 19:05 MarkMcCaskey

Thanks!

galo avatar May 24 '19 14:05 galo

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

hansoksendahl avatar Sep 05 '19 16:09 hansoksendahl

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

vezult avatar Feb 14 '20 17:02 vezult