rethinkdb-dockerfiles
rethinkdb-dockerfiles copied to clipboard
Alpine version of container
I'd really love to see alpine version in here. This would reduce image size even more :)
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: https://github.com/rethinkdb/rethinkdb-dockerfiles/pull/27#issuecomment-212648891
There's an example of sorts here: https://github.com/jlhawn/rethinkdb-docker
Disclosure: jlhawn and I both work at Docker.
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 therethinkdb
binary. This is therethinkdb-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. andlibexecinfo
has to be installed from theedge/testing
repo) and then therethinkdb
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):
@stuartpb this looks like great instruction from @jlhawn Now probably some clever pull request should be made, so that auto-builds could be done :)
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:
@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/?
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
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.
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
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.
#45 looks like the most likely candidate to close this issue right now.