Skip to content

Commit

Permalink
chore(*) whitespace and consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
Tieske committed Jun 24, 2021
1 parent 46ca9a4 commit c4e751f
Show file tree
Hide file tree
Showing 10 changed files with 318 additions and 301 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

[*.sh]
indent_style = space
indent_size = 2

[Dockerfile]
indent_style = space
indent_size = 2

[Makefile]
indent_style = tab
48 changes: 24 additions & 24 deletions alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,32 @@ ARG KONG_ARM64_SHA="5ec35d1b19dd4e6592ad2c6586e68bfd1549c6a22840ce7d5654677b94e5
ENV KONG_ARM64_SHA $KONG_ARM64_SHA

RUN set -eux; \
arch="$(apk --print-arch)"; \
case "${arch}" in \
x86_64) arch='amd64'; KONG_SHA256=$KONG_AMD64_SHA ;; \
aarch64) arch='arm64'; KONG_SHA256=$KONG_ARM64_SHA ;; \
esac; \
arch="$(apk --print-arch)"; \
case "${arch}" in \
x86_64) arch='amd64'; KONG_SHA256=$KONG_AMD64_SHA ;; \
aarch64) arch='arm64'; KONG_SHA256=$KONG_ARM64_SHA ;; \
esac; \
if [ "$ASSET" = "ce" ] ; then \
apk add --no-cache --virtual .build-deps curl wget tar ca-certificates && \
curl -fL "https://download.konghq.com/gateway-${KONG_VERSION%%.*}.x-alpine/kong-$KONG_VERSION.$arch.apk.tar.gz" -o /tmp/kong.tar.gz && \
echo "$KONG_SHA256 /tmp/kong.tar.gz" | sha256sum -c -; \
apk del .build-deps; \
apk add --no-cache --virtual .build-deps curl wget tar ca-certificates \
&& curl -fL "https://download.konghq.com/gateway-${KONG_VERSION%%.*}.x-alpine/kong-$KONG_VERSION.$arch.apk.tar.gz" -o /tmp/kong.tar.gz \
&& echo "$KONG_SHA256 /tmp/kong.tar.gz" | sha256sum -c - \
&& apk del .build-deps; \
fi; \
mkdir /kong; \
tar -C /kong -xzf /tmp/kong.tar.gz && \
mv /kong/usr/local/* /usr/local && \
mv /kong/etc/* /etc && \
rm -rf /kong && \
apk add --no-cache libstdc++ libgcc openssl pcre perl tzdata libcap zip bash zlib zlib-dev git ca-certificates && \
adduser -S kong && \
mkdir -p "/usr/local/kong" && \
chown -R kong:0 /usr/local/kong && \
chown kong:0 /usr/local/bin/kong && \
chmod -R g=u /usr/local/kong && \
rm -rf /tmp/kong.tar.gz && \
if [ "$ASSET" = "ce" ] ; then \
kong version ; \
fi;
mkdir /kong \
&& tar -C /kong -xzf /tmp/kong.tar.gz \
&& mv /kong/usr/local/* /usr/local \
&& mv /kong/etc/* /etc \
&& rm -rf /kong \
&& apk add --no-cache libstdc++ libgcc openssl pcre perl tzdata libcap zip bash zlib zlib-dev git ca-certificates \
&& adduser -S kong \
&& mkdir -p "/usr/local/kong" \
&& chown -R kong:0 /usr/local/kong \
&& chown kong:0 /usr/local/bin/kong \
&& chmod -R g=u /usr/local/kong \
&& rm -rf /tmp/kong.tar.gz \
&& if [ "$ASSET" = "ce" ] ; then \
kong version; \
fi

COPY docker-entrypoint.sh /docker-entrypoint.sh

Expand Down
38 changes: 19 additions & 19 deletions alpine/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@ set -Eeo pipefail
# usage: file_env VAR [DEFAULT]
# ie: file_env 'XYZ_DB_PASSWORD' 'example'
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
file_env() {
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"
# Do not continue if _FILE env is not set
if ! [ "${!fileVar:-}" ]; then
return
elif [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1
fi
local val="$def"
if [ "${!var:-}" ]; then
val="${!var}"
elif [ "${!fileVar:-}" ]; then
val="$(< "${!fileVar}")"
fi
export "$var"="$val"
unset "$fileVar"
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"
# Do not continue if _FILE env is not set
if ! [ "${!fileVar:-}" ]; then
return
elif [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1
fi
local val="$def"
if [ "${!var:-}" ]; then
val="${!var}"
elif [ "${!fileVar:-}" ]; then
val="$(< "${!fileVar}")"
fi
export "$var"="$val"
unset "$fileVar"
}

export KONG_NGINX_DAEMON=${KONG_NGINX_DAEMON:=off}
Expand Down
36 changes: 18 additions & 18 deletions centos/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@ ENV KONG_VERSION $KONG_VERSION
ARG KONG_SHA256="b8083a6c268f69865e66a8d504fcdacab49ba36a4194ccfc9737d65e6863c30a"

RUN set -ex; \
if [ "$ASSET" = "ce" ] ; then \
curl -fL https://download.konghq.com/gateway-${KONG_VERSION%%.*}.x-centos-7/Packages/k/kong-$KONG_VERSION.el7.amd64.rpm -o /tmp/kong.rpm \
&& echo "$KONG_SHA256 /tmp/kong.rpm" | sha256sum -c -; \
fi; \
yum install -y -q unzip shadow-utils git \
&& yum clean all -q \
&& rm -fr /var/cache/yum/* /tmp/yum_save*.yumtx /root/.pki \
# Please update the centos install docs if the below line is changed so that
# end users can properly install Kong along with its required dependencies
# and that our CI does not diverge from our docs.
&& yum install -y /tmp/kong.rpm \
&& yum clean all \
&& rm /tmp/kong.rpm \
&& chown kong:0 /usr/local/bin/kong \
&& chown -R kong:0 /usr/local/kong && \
if [ "$ASSET" = "ce" ] ; then \
kong version ; \
fi;
if [ "$ASSET" = "ce" ] ; then \
curl -fL https://download.konghq.com/gateway-${KONG_VERSION%%.*}.x-centos-7/Packages/k/kong-$KONG_VERSION.el7.amd64.rpm -o /tmp/kong.rpm \
&& echo "$KONG_SHA256 /tmp/kong.rpm" | sha256sum -c -; \
fi; \
yum install -y -q unzip shadow-utils git \
&& yum clean all -q \
&& rm -fr /var/cache/yum/* /tmp/yum_save*.yumtx /root/.pki \
# Please update the centos install docs if the below line is changed so that
# end users can properly install Kong along with its required dependencies
# and that our CI does not diverge from our docs.
&& yum install -y /tmp/kong.rpm \
&& yum clean all \
&& rm /tmp/kong.rpm \
&& chown kong:0 /usr/local/bin/kong \
&& chown -R kong:0 /usr/local/kong \
&& if [ "$ASSET" = "ce" ] ; then \
kong version ; \
fi

COPY docker-entrypoint.sh /docker-entrypoint.sh

Expand Down
38 changes: 19 additions & 19 deletions centos/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@ set -Eeo pipefail
# usage: file_env VAR [DEFAULT]
# ie: file_env 'XYZ_DB_PASSWORD' 'example'
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
file_env() {
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"
# Do not continue if _FILE env is not set
if ! [ "${!fileVar:-}" ]; then
return
elif [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1
fi
local val="$def"
if [ "${!var:-}" ]; then
val="${!var}"
elif [ "${!fileVar:-}" ]; then
val="$(< "${!fileVar}")"
fi
export "$var"="$val"
unset "$fileVar"
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"
# Do not continue if _FILE env is not set
if ! [ "${!fileVar:-}" ]; then
return
elif [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1
fi
local val="$def"
if [ "${!var:-}" ]; then
val="${!var}"
elif [ "${!fileVar:-}" ]; then
val="$(< "${!fileVar}")"
fi
export "$var"="$val"
unset "$fileVar"
}

export KONG_NGINX_DAEMON=${KONG_NGINX_DAEMON:=off}
Expand Down
10 changes: 5 additions & 5 deletions rhel/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ ENV KONG_SHA256 $KONG_SHA256

RUN set -ex; \
if [ "$ASSET" = "ce" ] ; then \
curl -fL "https://download.konghq.com/gateway-${KONG_VERSION%%.*}.x-rhel-$RHEL_VERSION/Packages/k/kong-$KONG_VERSION.rhel${RHEL_VERSION}.amd64.rpm" -o /tmp/kong.rpm \
&& echo "$KONG_SHA256 /tmp/kong.rpm" | sha256sum -c -; \
curl -fL "https://download.konghq.com/gateway-${KONG_VERSION%%.*}.x-rhel-$RHEL_VERSION/Packages/k/kong-$KONG_VERSION.rhel${RHEL_VERSION}.amd64.rpm" -o /tmp/kong.rpm \
&& echo "$KONG_SHA256 /tmp/kong.rpm" | sha256sum -c -; \
fi; \
yum install -y -q unzip shadow-utils \
&& yum clean all -q \
Expand All @@ -45,10 +45,10 @@ RUN set -ex; \
&& yum clean all \
&& rm /tmp/kong.rpm \
&& chown kong:0 /usr/local/bin/kong \
&& chown -R kong:0 /usr/local/kong && \
if [ "$ASSET" = "ce" ] ; then \
&& chown -R kong:0 /usr/local/kong \
&& if [ "$ASSET" = "ce" ] ; then \
kong version ; \
fi;
fi

COPY docker-entrypoint.sh /docker-entrypoint.sh

Expand Down
38 changes: 19 additions & 19 deletions rhel/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@ set -Eeo pipefail
# usage: file_env VAR [DEFAULT]
# ie: file_env 'XYZ_DB_PASSWORD' 'example'
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
file_env() {
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"
# Do not continue if _FILE env is not set
if ! [ "${!fileVar:-}" ]; then
return
elif [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1
fi
local val="$def"
if [ "${!var:-}" ]; then
val="${!var}"
elif [ "${!fileVar:-}" ]; then
val="$(< "${!fileVar}")"
fi
export "$var"="$val"
unset "$fileVar"
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"
# Do not continue if _FILE env is not set
if ! [ "${!fileVar:-}" ]; then
return
elif [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1
fi
local val="$def"
if [ "${!var:-}" ]; then
val="${!var}"
elif [ "${!fileVar:-}" ]; then
val="$(< "${!fileVar}")"
fi
export "$var"="$val"
unset "$fileVar"
}

export KONG_NGINX_DAEMON=${KONG_NGINX_DAEMON:=off}
Expand Down
Loading

0 comments on commit c4e751f

Please sign in to comment.