diff --git a/Dockerfile b/Dockerfile index 4cfbada..5dd0f91 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,20 +14,20 @@ RUN apk add --no-cache su-exec tzdata make curl build-base linux-headers bash op WORKDIR /tmp -RUN REDIS_VERSION=$(echo ${REDIS_VERSION} | sed 's/^v//'); \ - case "${REDIS_VERSION}" in \ - latest | stable) REDIS_DOWNLOAD_URL="http://download.redis.io/redis-stable.tar.gz";; \ - *) REDIS_DOWNLOAD_URL="http://download.redis.io/releases/redis-${REDIS_VERSION}.tar.gz";; \ +RUN VERSION=$(echo ${REDIS_VERSION} | sed -e "s/^v//g"); \ + case "${VERSION}" in \ + latest | stable) REDIS_DOWNLOAD_URL="http://download.redis.io/redis-stable.tar.gz" && VERSION="stable";; \ + *) REDIS_DOWNLOAD_URL="http://download.redis.io/releases/redis-${VERSION}.tar.gz";; \ esac; \ - curl -fL -Lo redis-${REDIS_VERSION}.tar.gz ${REDIS_DOWNLOAD_URL}; \ - tar xvzf redis-${REDIS_VERSION}.tar.gz + curl -fL -Lo redis-${VERSION}.tar.gz ${REDIS_DOWNLOAD_URL}; \ + tar xvzf redis-${VERSION}.tar.gz -WORKDIR /tmp/redis-${REDIS_VERSION} +WORKDIR /tmp/redis-${VERSION} RUN arch="$(uname -m)"; \ extraJemallocConfigureFlags="--with-lg-page=16"; \ if [ "$arch" = "aarch64" ] || [ "$arch" = "arm64" ]; then \ - sed -ri 's!cd jemalloc && ./configure !&'"$extraJemallocConfigureFlags"' !' /tmp/redis-${REDIS_VERSION}/deps/Makefile; \ + sed -ri 's!cd jemalloc && ./configure !&'"$extraJemallocConfigureFlags"' !' /tmp/redis-${VERSION}/deps/Makefile; \ fi; \ export BUILD_TLS=yes; \ make all; \ diff --git a/Dockerfile.exporter b/Dockerfile.exporter index bf924f0..51b722c 100644 --- a/Dockerfile.exporter +++ b/Dockerfile.exporter @@ -4,16 +4,15 @@ ARG TARGETARCH ARG EXPORTER_URL="https://github.com/oliver006/redis_exporter/releases/download" -ARG REDIS_EXPORTER_VERSION="1.48.0" +ARG REDIS_EXPORTER_VERSION="v1.48.0" WORKDIR /tmp -RUN REDIS_EXPORTER_VERSION=$(echo ${REDIS_EXPORTER_VERSION} | sed 's/^v//'); \ - apk add --no-cache curl ca-certificates; \ - curl -fL -Lo redis_exporter-v${REDIS_EXPORTER_VERSION}.linux-$TARGETARCH.tar.gz \ - ${EXPORTER_URL}/v${REDIS_EXPORTER_VERSION}/redis_exporter-v${REDIS_EXPORTER_VERSION}.linux-$TARGETARCH.tar.gz; \ - tar -xvzf redis_exporter-v${REDIS_EXPORTER_VERSION}.linux-$TARGETARCH.tar.gz; \ - mv redis_exporter-v${REDIS_EXPORTER_VERSION}.linux-$TARGETARCH redis_exporter +RUN apk add --no-cache curl ca-certificates; \ + curl -fL -Lo redis_exporter-${REDIS_EXPORTER_VERSION}.linux-$TARGETARCH.tar.gz \ + ${EXPORTER_URL}/${REDIS_EXPORTER_VERSION}/redis_exporter-${REDIS_EXPORTER_VERSION}.linux-$TARGETARCH.tar.gz; \ + tar -xvzf redis_exporter-${REDIS_EXPORTER_VERSION}.linux-$TARGETARCH.tar.gz; \ + mv redis_exporter-${REDIS_EXPORTER_VERSION}.linux-$TARGETARCH redis_exporter FROM scratch diff --git a/Dockerfile.sentinel b/Dockerfile.sentinel index 4967724..bf1dc50 100644 --- a/Dockerfile.sentinel +++ b/Dockerfile.sentinel @@ -12,25 +12,25 @@ RUN apk add --no-cache su-exec tzdata make curl build-base linux-headers bash op WORKDIR /tmp -RUN REDIS_SENTINEL_VERSION=$(echo ${REDIS_SENTINEL_VERSION} | sed 's/^v//'); \ - case "${REDIS_SENTINEL_VERSION}" in \ - latest | stable) REDIS_DOWNLOAD_URL="http://download.redis.io/redis-stable.tar.gz";; \ - *) REDIS_DOWNLOAD_URL="http://download.redis.io/releases/redis-${REDIS_SENTINEL_VERSION}.tar.gz";; \ +RUN VERSION=$(echo ${REDIS_SENTINEL_VERSION} | sed -e "s/^v//g"); \ + case "${VERSION}" in \ + latest | stable) REDIS_DOWNLOAD_URL="http://download.redis.io/redis-stable.tar.gz" && VERSION="stable";; \ + *) REDIS_DOWNLOAD_URL="http://download.redis.io/releases/redis-${VERSION}.tar.gz";; \ esac; \ \ - curl -fL -Lo redis-${REDIS_SENTINEL_VERSION}.tar.gz ${REDIS_DOWNLOAD_URL}; \ - tar xvzf redis-${REDIS_SENTINEL_VERSION}.tar.gz + curl -fL -Lo redis-${VERSION}.tar.gz ${REDIS_DOWNLOAD_URL}; \ + tar xvzf redis-${VERSION}.tar.gz WORKDIR /tmp RUN arch="$(uname -m)"; \ extraJemallocConfigureFlags="--with-lg-page=16"; \ if [ "$arch" = "aarch64" ] || [ "$arch" = "arm64" ]; then \ - sed -ri 's!cd jemalloc && ./configure !&'"$extraJemallocConfigureFlags"' !' /tmp/redis-${REDIS_SENTINEL_VERSION}/deps/Makefile; \ + sed -ri 's!cd jemalloc && ./configure !&'"$extraJemallocConfigureFlags"' !' /tmp/redis-${VERSION}/deps/Makefile; \ fi; \ export BUILD_TLS=yes; \ - make -C redis-${REDIS_SENTINEL_VERSION} all; \ - make -C redis-${REDIS_SENTINEL_VERSION} install + make -C redis-${VERSION} all; \ + make -C redis-${VERSION} install FROM alpine:3.15