美文网首页
基于alpine linux的docker上编译armadill

基于alpine linux的docker上编译armadill

作者: never615 | 来源:发表于2020-02-17 17:35 被阅读0次

    参考: https://mlpack.org/gsocblog/Saurabh2017WeekOne.html

    More on alpine based docker image: As we know alpine linux is small with many packages missing in the package manager. While working with it, I realized that there is no package for armadillo (c++ linear algebra library) and I have to build it from scratch. After completing building mlpack on this alpine linux based container, while running the tests, it terminated with errors. It cannot find the libarmadillo.so.x installed on the system. On further investigation and help from the mentor, turns out Alpine ships with uclibc not glibc and this will cause many other issues and will produce a build environment too far away from what mlpack's users typically have. So, now I'll be trying building the image using another minimal base image (for eg. busybox with glibc).

    安装glibc:
    简版:
    来自:https://github.com/sgerrand/alpine-pkg-glibc

    apk --no-cache add ca-certificates wget
    wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
    wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.28-r0/glibc-2.28-r0.apk
    apk add glibc-2.28-r0.apk
    

    复杂版:
    来自:https://github.com/Docker-Hub-frolvlad/docker-alpine-glibc/blob/master/Dockerfile

    # 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.30-r0" && \
        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 && \
        echo \
            "-----BEGIN PUBLIC KEY-----\
            MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApZ2u1KJKUu/fW4A25y9m\
            y70AGEa/J3Wi5ibNVGNn1gT1r0VfgeWd0pUybS4UmcHdiNzxJPgoWQhV2SSW1JYu\
            tOqKZF5QSN6X937PTUpNBjUvLtTQ1ve1fp39uf/lEXPpFpOPL88LKnDBgbh7wkCp\
            m2KzLVGChf83MS0ShL6G9EQIAUxLm99VpgRjwqTQ/KfzGtpke1wqws4au0Ab4qPY\
            KXvMLSPLUp7cfulWvhmZSegr5AdhNw5KNizPqCJT8ZrGvgHypXyiFvvAH5YRtSsc\
            Zvo9GI2e2MaZyo9/lvb+LbLEJZKEQckqRj4P26gmASrZEPStwc+yqy1ShHLA0j6m\
            1QIDAQAB\
            -----END PUBLIC KEY-----" | sed 's/   */\n/g' > "/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 "$LANG" || true && \
        echo "export LANG=$LANG" > /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"
    

    相关文章

      网友评论

          本文标题:基于alpine linux的docker上编译armadill

          本文链接:https://www.haomeiwen.com/subject/sjcifhtx.html