postgresqldockerfilealpine-linuxtimescaledb

Install timescaledb-toolkit in alpine linux


I have a docker image that is generated using https://github.com/timescale/timescaledb

The base OS of my docker image is Alpine. Could not find any document that uses apk to install the toolkit


Solution

  • I used below part in my dockerfile to install timescaledb-toolkit

    ENV DNF_INSTALL_FLAGS="-y --disableplugin=subscription-manager --setopt=tsflags=nodocs --setopt=install_weak_deps=0 --nodocs"

    RUN set -ex
    && microdnf install $DNF_INSTALL_FLAGS
    openssl
    wget
    glibc \ && RUNTIME_INSTALLED_PACKAGES="$(rpm -qa | sort)"
    && mkdir -p /build/
    # Only for build time && microdnf install $DNF_INSTALL_FLAGS \
    openssl-devel
    gcc
    krb5-devel
    glibc-devel
    make
    cmake
    tar
    bzip2
    git \ curl pkgconfig clang
    \ && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \ && source $HOME/.cargo/env \ && cargo install --version '=0.9.7' --force cargo-pgrx \ && cargo pgrx init --pg15 pg_config \ && git clone https://github.com/timescale/timescaledb-toolkit /build/timescaledb-toolkit \ && cd /build/timescaledb-toolkit/extension \ && cargo pgrx install --release \ && cargo run --manifest-path ../tools/post-install/Cargo.toml -- pg_config
    # Build current version
    && git clone https://github.com/timescale/timescaledb /build/timescaledb
    && cd /build/timescaledb && rm -fr build
    && git checkout ${TS_VERSION}
    && ./bootstrap -DCMAKE_BUILD_TYPE=RelWithDebInfo -DREGRESS_CHECKS=OFF -DTAP_CHECKS=OFF -DGENERATE_DOWNGRADE_SCRIPT=ON -DWARNINGS_AS_ERRORS=OFF -DPROJECT_INSTALL_METHOD="docker"
    && cd build && make install
    && cd ~

    # Remove compilation related dependencies. && echo "Removing all build dependencies." \ && BUILD_DEPENDENCIES=$( comm -13 <( echo "$RUNTIME_INSTALLED_PACKAGES" ) <( echo "$(rpm -qa | sort)" ) ) \ && rpm -e --allmatches --nodeps --noscripts --notriggers $BUILD_DEPENDENCIES
    && microdnf clean all --enablerepo='' --disableplugin=subscription-manager \ && rustup self uninstall -y \ && rm -rf /root/.cargo \ && rm -rf /root/.rustup \ && rm -rf /root/.pgrx
    && rm -rf
    /build
    "${HOME}/.cache"
    /var/cache/yum \
    && sed -r -i "s/[#]
    \s*(shared_preload_libraries)\s*=\s*'(.*)'/\1 = 'timescaledb,\2'/;s/,'/'/" $(pg_config --sharedir)/postgresql.conf.sample