Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support alpine Docker image environment #37

Closed
mschuchard opened this issue May 7, 2018 · 5 comments
Closed

Support alpine Docker image environment #37

mschuchard opened this issue May 7, 2018 · 5 comments
Labels
feedback Waiting on feedback before further action

Comments

@mschuchard
Copy link

I am trying to create a Docker image for this as it would be very useful in multi-stage builds for Ruby software or with e.g. OpenFaaS. Unfortunately, it seems to not be usable in an Alpine linux image.

A simple image file:

ARG rubyvers
FROM ruby:${rubyvers}-alpine
RUN apk add --no-cache squashfs-tools gcc make curl ca-certificates && curl -L http://enclose.io/rubyc/rubyc-linux-x64.gz | gunzip > /usr/bin/rubyc && chmod +rx /usr/bin/rubyc
RUN rubyc

yields:

/bin/sh: rubyc: not found

Note that the same error results from providing a full path to rubyc.

Debugging the image with a statically compiled/linked goss go binary:

RUN curl -L https://github.com/aelsabbahy/goss/releases/download/v0.3.5/goss-linux-amd64 -o /usr/bin/goss
RUN goss

works correctly and proves there is some kind of incompatibility here.

@mschuchard mschuchard changed the title Support alpine Docker image Support alpine Docker image environment May 7, 2018
@drbrain
Copy link
Collaborator

drbrain commented May 9, 2018

I've seen this same issue building go binaries on the ubuntu:16.04 image and trying to run them on the alpine:latest image.

Some googling suggests installing libc6-compat may allow you to run rubyc?

@drbrain drbrain added the feedback Waiting on feedback before further action label May 9, 2018
@mschuchard
Copy link
Author

Looked into those glibc dynamic linking workarounds and they do not seem to be working in this situation.

Should I be looking into other software for lightweight Ruby software packaging and containerization, or is there interest in first party support for this?

I know Hashi just released a Vagrant version packaged with AppImage so that route may work.

@drbrain
Copy link
Collaborator

drbrain commented May 10, 2018

I don't know what is different about the alpine linux environment and unfortunately I don't have the time to figure out how to get the packaged rubyc to work in it.

You can define a Dockerfile that builds rubyc under alpine, then uses that rubyc to package your application, then copies the packaged application to a standalone image. I have added some instructions for building rubyc yourself to the README that may get you started.

Since you need the same toolchain for building your own rubyc and for packaging your application with rubyc the main downside is the extra time spent building rubyc. Of course, you can store your alpine-compatible rubyc to save time.

@mschuchard
Copy link
Author

Sure, if the AppImage route does not work I will look at building rubyc with musl links.
Thanks.

@drbrain
Copy link
Collaborator

drbrain commented May 10, 2018

Great, thanks for the feedback, and let us know if we can improve the build instructions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feedback Waiting on feedback before further action
Projects
None yet
Development

No branches or pull requests

2 participants