diff --git a/.github/workflows/push-image.yaml b/.github/workflows/cd.yaml similarity index 77% rename from .github/workflows/push-image.yaml rename to .github/workflows/cd.yaml index 3a839bc..67bb751 100644 --- a/.github/workflows/push-image.yaml +++ b/.github/workflows/cd.yaml @@ -1,4 +1,4 @@ -name: Docker +name: Docker Image CD on: push: @@ -11,6 +11,9 @@ env: jobs: build_redis: + strategy: + matrix: + version: [v6.2.14, v7.0.15, latest] runs-on: ubuntu-latest steps: - name: Checkout @@ -32,9 +35,14 @@ jobs: file: Dockerfile platforms: linux/amd64,linux/arm64 push: true - tags: quay.io/opstree/redis:${{ env.REDIS_VERSION }} + build-args: | + REDIS_VERSION: ${{ matrix.version }} + tags: quay.io/opstree/redis:${{ matrix.version }} build_redis_sentinel: + strategy: + matrix: + version: [v6.2.14, v7.0.15, latest] runs-on: ubuntu-latest steps: - name: Checkout @@ -56,9 +64,14 @@ jobs: file: Dockerfile.sentinel platforms: linux/amd64,linux/arm64 push: true - tags: quay.io/opstree/redis-sentinel:${{ env.REDIS_SENTINEL_VERSION }} + build-args: | + REDIS_SENTINEL_VERSION: ${{ matrix.version }} + tags: quay.io/opstree/redis-sentinel:${{ matrix.version }} build_redis_exporter: + strategy: + matrix: + version: [v1.48.0] runs-on: ubuntu-latest steps: - name: Checkout @@ -80,4 +93,6 @@ jobs: file: Dockerfile.exporter platforms: linux/amd64,linux/arm64 push: true - tags: quay.io/opstree/redis-exporter:${{ env.REDIS_EXPORTER_VERSION }} + build-args: | + REDIS_EXPORTER_VERSION: ${{ matrix.version }} + tags: quay.io/opstree/redis-exporter:${{ matrix.version }} diff --git a/.github/workflows/docker-image.yml b/.github/workflows/ci.yml similarity index 87% rename from .github/workflows/docker-image.yml rename to .github/workflows/ci.yml index 4674582..0ac49e1 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ name: Docker Image CI on: pull_request: - branches: [ "master" ] + branches: [master] jobs: build_dockerfile: @@ -14,7 +14,7 @@ jobs: name: Lint Dockerfile with: dockerfile: Dockerfile - ignore: DL3007,DL3018 + ignore: DL3007,DL3018,SC2086,DL4006 - name: Build Dockerfile run: docker build . --file Dockerfile --tag redis:$(date +%s) @@ -28,7 +28,7 @@ jobs: name: Lint Dockerfile.exporter with: dockerfile: Dockerfile.exporter - ignore: DL3007,DL3018 + ignore: DL3007,DL3018,SC2086,DL4006 - name: Build Dockerfile.exporter run: docker build . --file Dockerfile.exporter --tag redis-exporter:$(date +%s) @@ -42,7 +42,7 @@ jobs: name: Lint Dockerfile.sentinel with: dockerfile: Dockerfile.sentinel - ignore: DL3007,DL3018 + ignore: DL3007,DL3018,SC2086,DL4006 - name: Build Dockerfile.sentinel run: docker build . --file Dockerfile.sentinel --tag redis-sentinel:$(date +%s) diff --git a/Dockerfile b/Dockerfile index f79a317..cb5eb42 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,15 +8,18 @@ LABEL version=1.0 \ arch=$TARGETARCH \ description="A production grade performance tuned redis docker image created by Opstree Solutions" -ARG REDIS_DOWNLOAD_URL="http://download.redis.io/" - ARG REDIS_VERSION="stable" RUN apk add --no-cache su-exec tzdata make curl build-base linux-headers bash openssl-dev WORKDIR /tmp -RUN curl -fL -Lo redis-${REDIS_VERSION}.tar.gz ${REDIS_DOWNLOAD_URL}/redis-${REDIS_VERSION}.tar.gz && \ +RUN REDIS_VERSION=$(echo ${REDIS_VERSION} | sed 's/^v//'); \ + case "${REDIS_VERSION}" in \ + latest | stable) REDIS_DOWNLOAD_URL="http://download.redis.io";; \ + *) REDIS_DOWNLOAD_URL="http://download.redis.io/releases";; \ + esac; \ + curl -fL -Lo redis-${REDIS_VERSION}.tar.gz ${REDIS_DOWNLOAD_URL}/redis-${REDIS_VERSION}.tar.gz; \ tar xvzf redis-${REDIS_VERSION}.tar.gz WORKDIR /tmp/redis-${REDIS_VERSION} diff --git a/Dockerfile.exporter b/Dockerfile.exporter index 55c412d..bf924f0 100644 --- a/Dockerfile.exporter +++ b/Dockerfile.exporter @@ -8,10 +8,11 @@ ARG REDIS_EXPORTER_VERSION="1.48.0" WORKDIR /tmp -RUN apk add --no-cache curl ca-certificates && \ +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 && \ + ${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 FROM scratch diff --git a/Dockerfile.sentinel b/Dockerfile.sentinel index 064f9e7..a2e427c 100644 --- a/Dockerfile.sentinel +++ b/Dockerfile.sentinel @@ -6,24 +6,31 @@ LABEL version=1.0 \ arch=$TARGETARCH \ description="A production grade performance tuned redis docker image created by Opstree Solutions" -ARG REDIS_DOWNLOAD_URL="http://download.redis.io/" - ARG REDIS_SENTINEL_VERSION="stable" RUN apk add --no-cache su-exec tzdata make curl build-base linux-headers bash openssl-dev WORKDIR /tmp -RUN curl -fL -Lo redis-${REDIS_SENTINEL_VERSION}.tar.gz ${REDIS_DOWNLOAD_URL}/redis-${REDIS_SENTINEL_VERSION}.tar.gz && \ - tar xvzf redis-${REDIS_SENTINEL_VERSION}.tar.gz && \ - arch="$(uname -m)"; \ +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_DOWNLOAD_URL="http://download.redis.io/releases";; \ + esac; \ + \ + curl -fL -Lo redis-${REDIS_SENTINEL_VERSION}.tar.gz ${REDIS_DOWNLOAD_URL}/redis-${REDIS_SENTINEL_VERSION}.tar.gz; \ + tar xvzf redis-${REDIS_SENTINEL_VERSION}.tar.gz + +WORKDIR /tmp/redis-${REDIS_SENTINEL_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_SENTINEL_VERSION}/deps/Makefile; \ fi; \ export BUILD_TLS=yes; \ - make -C redis-${REDIS_SENTINEL_VERSION} all; \ - make -C redis-${REDIS_SENTINEL_VERSION} install + make all; \ + make install FROM alpine:3.15