Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile & shell files lint #58

Merged
merged 9 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,40 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: hadolint/[email protected]
name: Lint Dockerfile
with:
dockerfile: Dockerfile
Azanul marked this conversation as resolved.
Show resolved Hide resolved
ignore: DL3007,DL3018

- name: Build Dockerfile
run: docker build . --file Dockerfile --tag redis:$(date +%s)

build_dockerfile_exporter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: hadolint/[email protected]
name: Lint Dockerfile.exporter
with:
dockerfile: Dockerfile.exporter
Azanul marked this conversation as resolved.
Show resolved Hide resolved
ignore: DL3007,DL3018

- name: Build Dockerfile.exporter
run: docker build . --file Dockerfile.exporter --tag redis-exporter:$(date +%s)

build_dockerfile_sentinel:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: hadolint/[email protected]
name: Lint Dockerfile.sentinel
with:
dockerfile: Dockerfile.sentinel
Azanul marked this conversation as resolved.
Show resolved Hide resolved
ignore: DL3007,DL3018

- name: Build Dockerfile.sentinel
run: docker build . --file Dockerfile.sentinel --tag redis-sentinel:$(date +%s)
14 changes: 14 additions & 0 deletions .github/workflows/shell-script.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Shell scripts CI

on:
pull_request:
branches: [ "master" ]

jobs:
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
29 changes: 16 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
FROM alpine:3.15 as builder

MAINTAINER Opstree Solutions
LABEL maintainer="Opstree Solutions"

ARG TARGETARCH

LABEL VERSION=1.0 \
ARCH=$TARGETARCH \
DESCRIPTION="A production grade performance tuned redis docker image created by Opstree Solutions"
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

RUN curl -fL -Lo /tmp/redis-${REDIS_VERSION}.tar.gz ${REDIS_DOWNLOAD_URL}/redis-${REDIS_VERSION}.tar.gz && \
cd /tmp && \
tar xvzf redis-${REDIS_VERSION}.tar.gz && \
cd redis-${REDIS_VERSION} && \
make && \
WORKDIR /tmp

RUN 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}
Azanul marked this conversation as resolved.
Show resolved Hide resolved

RUN make && \
Azanul marked this conversation as resolved.
Show resolved Hide resolved
make install BUILD_TLS=yes

FROM alpine:3.15

MAINTAINER Opstree Solutions
LABEL maintainer="Opstree Solutions"

ARG TARGETARCH

LABEL VERSION=1.0 \
ARCH=$TARGETARCH \
DESCRIPTION="A production grade performance tuned redis docker image created by Opstree Solutions"
LABEL version=1.0 \
arch=$TARGETARCH \
description="A production grade performance tuned redis docker image created by Opstree Solutions"

COPY --from=builder /usr/local/bin/redis-server /usr/local/bin/redis-server
COPY --from=builder /usr/local/bin/redis-cli /usr/local/bin/redis-cli
Expand Down
20 changes: 11 additions & 9 deletions Dockerfile.exporter
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,23 @@ ARG EXPORTER_URL="https://github.com/oliver006/redis_exporter/releases/download"

ARG REDIS_EXPORTER_VERSION="1.48.0"

RUN apk add --no-cache curl ca-certificates && \
curl -fL -Lo /tmp/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 && \
cd /tmp && tar -xvzf redis_exporter-v${REDIS_EXPORTER_VERSION}.linux-$TARGETARCH.tar.gz && \
mv redis_exporter-v${REDIS_EXPORTER_VERSION}.linux-$TARGETARCH redis_exporter
WORKDIR /tmp

RUN 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

FROM scratch

ARG TARGETARCH

MAINTAINER Opstree Solutions
LABEL maintainer="Opstree Solutions"

LABEL VERSION=1.0 \
ARCH=$TARGETARCH \
DESCRIPTION="A production grade redis exporter docker image created by Opstree Solutions"
LABEL vesrion=1.0 \
arch=$TARGETARCH \
description="A production grade redis exporter docker image created by Opstree Solutions"

COPY --from=builder /etc/ssl/certs /etc/ssl/certs
COPY --from=builder /tmp/redis_exporter/redis_exporter /usr/local/bin/redis_exporter
Expand Down
22 changes: 11 additions & 11 deletions Dockerfile.sentinel
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,30 @@ FROM alpine:3.15 as builder

ARG TARGETARCH

LABEL VERSION=1.0 \
ARCH=$TARGETARCH \
DESCRIPTION="A production grade performance tuned redis docker image created by Opstree Solutions"
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

RUN curl -fL -Lo /tmp/redis-${REDIS_SENTINEL_VERSION}.tar.gz ${REDIS_DOWNLOAD_URL}/redis-${REDIS_SENTINEL_VERSION}.tar.gz && \
cd /tmp && \
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 && \
cd redis-${REDIS_SENTINEL_VERSION} && \
make && \
make install BUILD_TLS=yes
make -C redis-${REDIS_SENTINEL_VERSION} && \
make -C redis-${REDIS_SENTINEL_VERSION} install BUILD_TLS=yes

FROM alpine:3.15

ARG TARGETARCH

LABEL VERSION=1.0 \
ARCH=$TARGETARCH \
DESCRIPTION="A production grade performance tuned redis docker image created by Opstree Solutions"
LABEL version=1.0 \
arch=$TARGETARCH \
description="A production grade performance tuned redis docker image created by Opstree Solutions"


COPY --from=builder /usr/local/bin/redis-cli /usr/local/bin/redis-cli
Expand Down
2 changes: 1 addition & 1 deletion create-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

PODS="$1"

yes yes | redis-cli --cluster create ${PODS}
yes yes | redis-cli --cluster create "${PODS}"
2 changes: 1 addition & 1 deletion healthcheck-Sentinel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ check_redis_health() {
if [[ "${TLS_MODE}" == "true" ]]; then
redis-cli --tls --cert "${REDIS_TLS_CERT}" --key "${REDIS_TLS_CERT_KEY}" --cacert "${REDIS_TLS_CA_KEY}" -h "$(hostname)" -p 26379 ping
else
redis-cli -h $(hostname) -p 26379 ping
redis-cli -h "$(hostname)" -p 26379 ping
fi
}

Expand Down
2 changes: 1 addition & 1 deletion healthcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ check_redis_health() {
if [[ "${TLS_MODE}" == "true" ]]; then
redis-cli --tls --cert "${REDIS_TLS_CERT}" --key "${REDIS_TLS_CERT_KEY}" --cacert "${REDIS_TLS_CA_KEY}" -h "$(hostname)" ping
else
redis-cli -h $(hostname) ping
redis-cli -h "$(hostname)" ping
fi
}

Expand Down