rqlite / rqlite-docker

rqlite docker images
MIT License
25 stars 11 forks source link

Switch to lighter, smaller base image #1

Closed otoolep closed 6 years ago

otoolep commented 7 years ago

The current image is based of Ubuntu yaketty. This image is >100MB, which is a shame considering rqlited is ~6MB. A smaller base image -- perhaps based on Alpine -- would be better.

otoolep commented 7 years ago

rqlited won't run in Alpine, might be because of lack of glibc.

kenjones-cisco commented 7 years ago

FYI, based on the solution for running generated binaries on Alpine that require glibc:

# Here we install GNU libc (aka glibc) and set C.UTF-8 locale as default.
RUN ALPINE_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases/download" && \
    ALPINE_GLIBC_PACKAGE_VERSION="2.23-r3" && \
    ALPINE_GLIBC_BASE_PACKAGE_FILENAME="glibc-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \
    ALPINE_GLIBC_BIN_PACKAGE_FILENAME="glibc-bin-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \
    ALPINE_GLIBC_I18N_PACKAGE_FILENAME="glibc-i18n-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \
    apk add --no-cache --virtual=.build-dependencies wget ca-certificates && \
    wget \
        "https://raw.githubusercontent.com/andyshinn/alpine-pkg-glibc/master/sgerrand.rsa.pub" \
        -O "/etc/apk/keys/sgerrand.rsa.pub" && \
    wget \
        "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \
        "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \
        "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" && \
    apk add --no-cache \
        "$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \
        "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \
        "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" && \
    \
    rm "/etc/apk/keys/sgerrand.rsa.pub" && \
    /usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 C.UTF-8 || true && \
    echo "export LANG=C.UTF-8" > /etc/profile.d/locale.sh && \
    \
    apk del glibc-i18n && \
    \
    rm "/root/.wget-hsts" && \
    apk del .build-dependencies && \
    rm \
        "$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \
        "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \
        "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME"
otoolep commented 7 years ago

Thank you @kenjones-cisco -- I will try that. Or perhaps you could generate a PR against https://github.com/rqlite/rqlite-docker/blob/master/4.0.0/Dockerfile ?

kenjones-cisco commented 7 years ago

PR #3 created

lordgnu commented 6 years ago

There is an alpine image for 4.2.0 currently (from PR #4), and I just submitted a PR #5 for an alpine image for 4.2.1. Since the binary is built in an alpine container, there is no need for glibc. That should resolve this issue I believe

otoolep commented 6 years ago

Thanks to you both @kenjones-cisco and @lordgnu -- let's go with the image mentioned by @lordgnu

kenjones-cisco commented 6 years ago

@otoolep When will the new alpine images get pushed to docker hub?

otoolep commented 6 years ago

I'm trying to build them locally, but for some reason am hitting an issue -- see here: https://github.com/rqlite/rqlite-docker/pull/4