There are undocumented dependencies needed for sentry-cli needed for alpine linux
To reproduce:
FROM alpine:edge
RUN apk add --update ca-certificates \
&& apk add bash curl
RUN curl -sL https://sentry.io/get-cli/ | bash
CMD bash
docker run -it sentry bash
bash-4.3# sentry-cli
bash: /usr/local/bin/sentry-cli: No such file or directory
bash-4.3# ls -al /usr/local/bin/
total 12644
drwxr-xr-x 2 root root 4096 May 15 19:02 .
drwxr-xr-x 7 root root 4096 May 15 19:02 ..
-rwxr-xr-x 1 root root 12935936 May 15 19:02 sentry-cli
bash-4.3#
I know that there is a dependency missing, I have another alpine image that works with sentry-cli installed the same way(I cannot post that docker file).
It would be nice if there was a more helpful error message so I know what is missing
Alpine linux does not come with glibc so you need to manually compile it for alpine linux manually from source. We should probably add this to the documentation but for the moment we do not have a reasonable way to avoid that dependency.
I actually just found why it works in my other image,
RUN set -x \
&& curl -sL https://github.com/DarthHater/docker-phantomjs2/releases/download/2.1.1/dockerized-phantomjs.tar.gz | tar xz -C / \
&& phantomjs --version \
&& curl -sL https://sentry.io/get-cli/ | bash
and it works fine...
phantomjs has a similar issue with glibc and apparently the workarounds there makes sentry-cli work as well.
Until recently linuxes without glibc were pretty uncommon but docker is setting a trend to have alpine there so we might investigate this again. The main issue I have is that the only alternative to glibc is musl and musl compiled binaries behave weirdly for some users (eg: ldd breaks).
@Rishka for what it's worth in that tarball is a full ubuntu installation. So your alpine linux becomes … ubuntu.
Well, I feel a bit dumb about that...
Ok, I'm working on building it in alpine, Ill post the docker file here if anyone else needs it
This seems to be the minimal docker image to build and run sentry-cli on Alpine:
FROM alpine:edge
RUN echo "http://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
ENV SENTRY_VERSION="1.9.2"
RUN apk add --no-cache --virtual .build-deps \
build-base \
openssl \
rust \
cargo \
git \
curl \
openssl-dev \
cmake \
file \
curl-dev \
gcc \
&& git clone -b $SENTRY_VERSION https://github.com/getsentry/sentry-cli.git /tmp/sentry \
&& cargo build --manifest-path /tmp/sentry/Cargo.toml --release \
&& mv /tmp/sentry/target/release/sentry-cli /usr/local/bin \
&& rm -rf /tmp/sentry \
&& rm -rf /root/.cargo \
&& apk del .build-deps \
&& apk add --no-cache curl llvm-libunwind openssl
I might look into musl builds again. I nuked and updated some dependencies so there might be fewer stoppers now.
@mitsuhiko Any progress on this?
@oscar-b there has been very little interest for alpine lately so I did not really look into it.
Ok :/ It's so much nicer for CI, cutting down on deploy times (GitLab CI).
You can try building the current version manually on alpine and then use that. I am pretty sure the current version should compile there.
@oscar-b I used the docker image above and exported the binary to my ci image. I think it only needs llvm-libunwind openssl as runtime dependencies
Seems like @Rishka instructions from earlier works! 💯
@Rishka Rust/Cargo seems to leave 260 Mb of installed packages in /root/.cargo, need to rm it.
updated the example
A Dockerfile and updated instructions have been added in https://github.com/getsentry/sentry-cli/commit/6f3f14497cc37637935042971af896d79cc415f9, so this should at least support the Alpine use case. It's not ideal yet as we're facing problems to build sentry-cli against musl libc. Until then, we're not going to publish a standalone binary.
Thank you all for your input on this issue.
Most helpful comment
I might look into musl builds again. I nuked and updated some dependencies so there might be fewer stoppers now.