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

Alpine version of container #32

Open
holms opened this issue Jul 19, 2016 · 11 comments
Open

Alpine version of container #32

holms opened this issue Jul 19, 2016 · 11 comments

Comments

@holms
Copy link

holms commented Jul 19, 2016

I'd really love to see alpine version in here. This would reduce image size even more :)

@stuartpb
Copy link
Collaborator

stuartpb commented Jul 19, 2016

I feel like this was discussed in the comments of one of the docker-library commits some time ago; my stance is that if you can convince RethinkDB to package for it (or write a simple enough way to assemble RethinkDB for Alpine in a Dockerfile), I'll include it and push a change to upstream tags accordingly (as this is the new best practice for Docker official images).

EDIT: I think I was talking about this one: #27 (comment)

@endophage
Copy link

There's an example of sorts here: https://github.com/jlhawn/rethinkdb-docker

Disclosure: jlhawn and I both work at Docker.

@jlhawn
Copy link

jlhawn commented Aug 9, 2016

It takes a while to build, so here's a quick description (sorry the README in that repo isn't much).

Results

REPOSITORY                 TAG                 IMAGE ID            CREATED             SIZE
jlhawn/rethinkdb           2.3.4               404ad9d9f3b0        10 minutes ago      58.41 MB
rethinkdb-build            latest              62f64aac45db        10 minutes ago      2.641 GB
rethinkdb                  2.3.4               84f2159c754f        7 days ago          183.8 MB
alpine                     3.4                 4e38e38c8ce0        6 weeks ago         4.795 MB

This compares my jlhawn/rethinkdb image with the current official rethinkdb image. It is only 58.4 MB (uncompressed) while the official image is 183.8 MB. The size comes from the official alpine base image which is 4.8 MB, some dependent libs, and the built binary which is another 46 MB. I'm already using SPLIT_SYMBOLS=1 in the build and I'm not sure if there's a way to make it any smaller.

The build is a 2-step build. There are 2 different Dockerfiles:

  • Dockerfile.build is used to actually build the RethinkDB binary. It's based on the unofficial RethinkDB package for Alpine for which there is a build script here: http://git.alpinelinux.org/cgit/aports/tree/testing/rethinkdb/APKBUILD
    The end result is a container image which contains the rethinkdb binary. This is the rethinkdb-build image in the list above. It's quite large since it contains all of the intermediate build artifacts (2.64 GB).
  • Dockerfile.min is used to grab dependencies for which there exist official alpine packages (libgcc, libstdc++, libcurl, protobuf, etc. and libexecinfo has to be installed from the edge/testing repo) and then the rethinkdb binary is copied from the previous build into this container image.

My favorite thing about this image is that there are no known vulnerabilities in any of the added components (aside from a low-impact one in the base image which should get resolved when the openssl package in the alpine:3.4 image is updated next):

screen shot 2016-08-09 at 12 39 35 pm

@holms
Copy link
Author

holms commented Aug 10, 2016

@stuartpb this looks like great instruction from @jlhawn
Now probably some clever pull request should be made, so that auto-builds could be done :)

@jlhawn
Copy link

jlhawn commented Sep 23, 2016

I'm a little late to the 2.3.5 party, but I just built 2.3.5 for Alpine Linux using this and it's free of the OpenSSL vulnerabilities reported just yesterday morning:

screen shot 2016-09-23 at 12 05 32 pm

@stuartpb
Copy link
Collaborator

@dalanmiller @danielmewes Thoughts on RethinkDB adopting something like https://github.com/jlhawn/rethinkdb-docker/blob/master/Dockerfile.build to add Alpine packaging to the official release builds on http://download.rethinkdb.com/?

@daveisfera
Copy link

Here's a Dockerfile that builds rethinkdb against Alpine 3.5 (the latest stable release). It's 73 MB compared to the 183 MB of the existing image and would allow those using Alpine as their base to have shared bases.

FROM alpine:3.5

ENV RETHINKDB_VERSION 2.3.5

RUN mkdir /tmp/build_rethinkdb && cd /tmp/build_rethinkdb \
    && apk add --no-cache curl --virtual .fetch-deps \
    && curl -sSLO https://download.rethinkdb.com/dist/rethinkdb-$RETHINKDB_VERSION.tgz \
    && tar xf rethinkdb-$RETHINKDB_VERSION.tgz \
    && cd rethinkdb-$RETHINKDB_VERSION \
    && curl -sSLO https://git.alpinelinux.org/cgit/aports/plain/community/rethinkdb/libressl.patch?h=3.5-stable \
    && patch -p1 -i libressl.patch?h=3.5-stable \
    && apk del .fetch-deps \
    && apk add --no-cache protobuf libressl libcurl boost libexecinfo \
    && apk add --no-cache bash python2 linux-headers bsd-compat-headers m4 paxmark protobuf-dev icu-dev libressl-dev curl-dev boost-dev libexecinfo-dev --virtual .build-deps \
    && apk add --no-cache g++ make --virtual .build-deps2 \
    && ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --dynamic all --with-system-malloc \
    && export CXXFLAGS="-fno-delete-null-pointer-checks" && export LDFLAGS="-lexecinfo" && make SYMBOLS=0 \
    && make install-binaries \
    && apk del .build-deps && apk del .build-deps2 \
    && rm -rf /tmp/build_rethinkdb

VOLUME ["/data"]

WORKDIR /data

CMD ["rethinkdb", "--bind", "all"]

#   process cluster webui
EXPOSE 28015 29015 8080

@franz-josef-kaiser
Copy link

Is there any progress here? I would love to see the Alpine image as pretty much all vendors now switched there, which means, that we already have AuFS persisting Alpine and ready to share, opposing to the Debian image in use here.

@zaherg
Copy link

zaherg commented May 18, 2018

Hey, its look like the latest version of alpine has rethinkdb ready to be installed https://pkgs.alpinelinux.org/packages?name=rethinkdb&branch=v3.7

@daveisfera
Copy link

Installing a package only supports the version available for the OS in questions. Building it from scratch is the preferred solution since you can support the newest/multiple versions. There are also advantages around compiler flags and build config, but the ability to control version is the primary driver for building from scratch.

@stuartpb
Copy link
Collaborator

stuartpb commented Oct 3, 2018

#45 looks like the most likely candidate to close this issue right now.

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

Successfully merging a pull request may close this issue.

7 participants