Skip to content

Commit

Permalink
Merge pull request #33 from theohbrothers/enhancement/add-docker-entr…
Browse files Browse the repository at this point in the history
…ypoint.sh

Enhancement: Add docker-entrypoint.sh
  • Loading branch information
leojonathanoh authored Sep 19, 2022
2 parents 6eb94bc + d6fc493 commit 9acdc63
Show file tree
Hide file tree
Showing 51 changed files with 360 additions and 25 deletions.
8 changes: 8 additions & 0 deletions generate/definitions/VARIANTS.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ $VARIANTS_SHARED = @{
}
)
}
'docker-entrypoint.sh' = @{
common = $true
passes = @(
@{
variables = @{}
}
)
}
}
}
}
5 changes: 4 additions & 1 deletion generate/templates/Dockerfile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on `$BUILDPLATFORM, building for `$TARGETPLATFORM"
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
# When `$TARGETPLATFORM is linux/arm/v7, strip out the '/v6' or '/v7' from it
RUN BIN_URL=https://storage.googleapis.com/kubernetes-release/release/$( $VARIANT['_metadata']['package_version'] )/bin/`$( echo `$TARGETPLATFORM | sed 's@/v[67]$@@' )/kubectl \
&& SHA512=`$( wget -qO- "`$BIN_URL.sha512" ) \
Expand Down Expand Up @@ -125,6 +128,6 @@ RUN apk add --no-cache --virtual .build-dependencies $PHPIZE_DEPS \
}

@"
CMD [ "/usr/local/bin/kubectl" ]
ENTRYPOINT [ "/docker-entrypoint.sh" ]
"@
12 changes: 12 additions & 0 deletions generate/templates/docker-entrypoint.sh.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@'
#!/bin/sh
set -eu
if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- kubectl "$@"
elif [ $# -gt 0 ] && kubectl "$1" --help > /dev/null 2>&1; then
set -- kubectl "$@"
fi
exec "$@"
'@
5 changes: 4 additions & 1 deletion variants/v1.14.10-alpine-3.8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

# When $TARGETPLATFORM is linux/arm/v7, strip out the '/v6' or '/v7' from it
RUN BIN_URL=https://storage.googleapis.com/kubernetes-release/release/v1.14.10/bin/$( echo $TARGETPLATFORM | sed 's@/v[67]$@@' )/kubectl \
&& SHA512=$( wget -qO- "$BIN_URL.sha512" ) \
Expand All @@ -11,4 +14,4 @@ RUN BIN_URL=https://storage.googleapis.com/kubernetes-release/release/v1.14.10/b
&& chmod +x /usr/local/bin/kubectl \
&& sha512sum /usr/local/bin/kubectl | grep "$SHA512"

CMD [ "/usr/local/bin/kubectl" ]
ENTRYPOINT [ "/docker-entrypoint.sh" ]
10 changes: 10 additions & 0 deletions variants/v1.14.10-alpine-3.8/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- kubectl "$@"
elif [ $# -gt 0 ] && kubectl "$1" --help > /dev/null 2>&1; then
set -- kubectl "$@"
fi

exec "$@"
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

# When $TARGETPLATFORM is linux/arm/v7, strip out the '/v6' or '/v7' from it
RUN BIN_URL=https://storage.googleapis.com/kubernetes-release/release/v1.14.10/bin/$( echo $TARGETPLATFORM | sed 's@/v[67]$@@' )/kubectl \
&& SHA512=$( wget -qO- "$BIN_URL.sha512" ) \
Expand Down Expand Up @@ -46,4 +49,4 @@ RUN apk add --no-cache gnupg

RUN apk add --no-cache openssh-client

CMD [ "/usr/local/bin/kubectl" ]
ENTRYPOINT [ "/docker-entrypoint.sh" ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- kubectl "$@"
elif [ $# -gt 0 ] && kubectl "$1" --help > /dev/null 2>&1; then
set -- kubectl "$@"
fi

exec "$@"
5 changes: 4 additions & 1 deletion variants/v1.15.12-alpine-3.8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

# When $TARGETPLATFORM is linux/arm/v7, strip out the '/v6' or '/v7' from it
RUN BIN_URL=https://storage.googleapis.com/kubernetes-release/release/v1.15.12/bin/$( echo $TARGETPLATFORM | sed 's@/v[67]$@@' )/kubectl \
&& SHA512=$( wget -qO- "$BIN_URL.sha512" ) \
Expand All @@ -11,4 +14,4 @@ RUN BIN_URL=https://storage.googleapis.com/kubernetes-release/release/v1.15.12/b
&& chmod +x /usr/local/bin/kubectl \
&& sha512sum /usr/local/bin/kubectl | grep "$SHA512"

CMD [ "/usr/local/bin/kubectl" ]
ENTRYPOINT [ "/docker-entrypoint.sh" ]
10 changes: 10 additions & 0 deletions variants/v1.15.12-alpine-3.8/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- kubectl "$@"
elif [ $# -gt 0 ] && kubectl "$1" --help > /dev/null 2>&1; then
set -- kubectl "$@"
fi

exec "$@"
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

# When $TARGETPLATFORM is linux/arm/v7, strip out the '/v6' or '/v7' from it
RUN BIN_URL=https://storage.googleapis.com/kubernetes-release/release/v1.15.12/bin/$( echo $TARGETPLATFORM | sed 's@/v[67]$@@' )/kubectl \
&& SHA512=$( wget -qO- "$BIN_URL.sha512" ) \
Expand Down Expand Up @@ -46,4 +49,4 @@ RUN apk add --no-cache gnupg

RUN apk add --no-cache openssh-client

CMD [ "/usr/local/bin/kubectl" ]
ENTRYPOINT [ "/docker-entrypoint.sh" ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- kubectl "$@"
elif [ $# -gt 0 ] && kubectl "$1" --help > /dev/null 2>&1; then
set -- kubectl "$@"
fi

exec "$@"
5 changes: 4 additions & 1 deletion variants/v1.16.15-alpine-3.8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

# When $TARGETPLATFORM is linux/arm/v7, strip out the '/v6' or '/v7' from it
RUN BIN_URL=https://storage.googleapis.com/kubernetes-release/release/v1.16.15/bin/$( echo $TARGETPLATFORM | sed 's@/v[67]$@@' )/kubectl \
&& SHA512=$( wget -qO- "$BIN_URL.sha512" ) \
Expand All @@ -11,4 +14,4 @@ RUN BIN_URL=https://storage.googleapis.com/kubernetes-release/release/v1.16.15/b
&& chmod +x /usr/local/bin/kubectl \
&& sha512sum /usr/local/bin/kubectl | grep "$SHA512"

CMD [ "/usr/local/bin/kubectl" ]
ENTRYPOINT [ "/docker-entrypoint.sh" ]
10 changes: 10 additions & 0 deletions variants/v1.16.15-alpine-3.8/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- kubectl "$@"
elif [ $# -gt 0 ] && kubectl "$1" --help > /dev/null 2>&1; then
set -- kubectl "$@"
fi

exec "$@"
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

# When $TARGETPLATFORM is linux/arm/v7, strip out the '/v6' or '/v7' from it
RUN BIN_URL=https://storage.googleapis.com/kubernetes-release/release/v1.16.15/bin/$( echo $TARGETPLATFORM | sed 's@/v[67]$@@' )/kubectl \
&& SHA512=$( wget -qO- "$BIN_URL.sha512" ) \
Expand Down Expand Up @@ -46,4 +49,4 @@ RUN apk add --no-cache gnupg

RUN apk add --no-cache openssh-client

CMD [ "/usr/local/bin/kubectl" ]
ENTRYPOINT [ "/docker-entrypoint.sh" ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- kubectl "$@"
elif [ $# -gt 0 ] && kubectl "$1" --help > /dev/null 2>&1; then
set -- kubectl "$@"
fi

exec "$@"
5 changes: 4 additions & 1 deletion variants/v1.17.17-alpine-3.8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

# When $TARGETPLATFORM is linux/arm/v7, strip out the '/v6' or '/v7' from it
RUN BIN_URL=https://storage.googleapis.com/kubernetes-release/release/v1.17.17/bin/$( echo $TARGETPLATFORM | sed 's@/v[67]$@@' )/kubectl \
&& SHA512=$( wget -qO- "$BIN_URL.sha512" ) \
Expand All @@ -11,4 +14,4 @@ RUN BIN_URL=https://storage.googleapis.com/kubernetes-release/release/v1.17.17/b
&& chmod +x /usr/local/bin/kubectl \
&& sha512sum /usr/local/bin/kubectl | grep "$SHA512"

CMD [ "/usr/local/bin/kubectl" ]
ENTRYPOINT [ "/docker-entrypoint.sh" ]
10 changes: 10 additions & 0 deletions variants/v1.17.17-alpine-3.8/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- kubectl "$@"
elif [ $# -gt 0 ] && kubectl "$1" --help > /dev/null 2>&1; then
set -- kubectl "$@"
fi

exec "$@"
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

# When $TARGETPLATFORM is linux/arm/v7, strip out the '/v6' or '/v7' from it
RUN BIN_URL=https://storage.googleapis.com/kubernetes-release/release/v1.17.17/bin/$( echo $TARGETPLATFORM | sed 's@/v[67]$@@' )/kubectl \
&& SHA512=$( wget -qO- "$BIN_URL.sha512" ) \
Expand Down Expand Up @@ -46,4 +49,4 @@ RUN apk add --no-cache gnupg

RUN apk add --no-cache openssh-client

CMD [ "/usr/local/bin/kubectl" ]
ENTRYPOINT [ "/docker-entrypoint.sh" ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- kubectl "$@"
elif [ $# -gt 0 ] && kubectl "$1" --help > /dev/null 2>&1; then
set -- kubectl "$@"
fi

exec "$@"
5 changes: 4 additions & 1 deletion variants/v1.18.20-alpine-3.8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

# When $TARGETPLATFORM is linux/arm/v7, strip out the '/v6' or '/v7' from it
RUN BIN_URL=https://storage.googleapis.com/kubernetes-release/release/v1.18.20/bin/$( echo $TARGETPLATFORM | sed 's@/v[67]$@@' )/kubectl \
&& SHA512=$( wget -qO- "$BIN_URL.sha512" ) \
Expand All @@ -11,4 +14,4 @@ RUN BIN_URL=https://storage.googleapis.com/kubernetes-release/release/v1.18.20/b
&& chmod +x /usr/local/bin/kubectl \
&& sha512sum /usr/local/bin/kubectl | grep "$SHA512"

CMD [ "/usr/local/bin/kubectl" ]
ENTRYPOINT [ "/docker-entrypoint.sh" ]
10 changes: 10 additions & 0 deletions variants/v1.18.20-alpine-3.8/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- kubectl "$@"
elif [ $# -gt 0 ] && kubectl "$1" --help > /dev/null 2>&1; then
set -- kubectl "$@"
fi

exec "$@"
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

# When $TARGETPLATFORM is linux/arm/v7, strip out the '/v6' or '/v7' from it
RUN BIN_URL=https://storage.googleapis.com/kubernetes-release/release/v1.18.20/bin/$( echo $TARGETPLATFORM | sed 's@/v[67]$@@' )/kubectl \
&& SHA512=$( wget -qO- "$BIN_URL.sha512" ) \
Expand Down Expand Up @@ -46,4 +49,4 @@ RUN apk add --no-cache gnupg

RUN apk add --no-cache openssh-client

CMD [ "/usr/local/bin/kubectl" ]
ENTRYPOINT [ "/docker-entrypoint.sh" ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- kubectl "$@"
elif [ $# -gt 0 ] && kubectl "$1" --help > /dev/null 2>&1; then
set -- kubectl "$@"
fi

exec "$@"
5 changes: 4 additions & 1 deletion variants/v1.19.16-alpine-3.8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

# When $TARGETPLATFORM is linux/arm/v7, strip out the '/v6' or '/v7' from it
RUN BIN_URL=https://storage.googleapis.com/kubernetes-release/release/v1.19.16/bin/$( echo $TARGETPLATFORM | sed 's@/v[67]$@@' )/kubectl \
&& SHA512=$( wget -qO- "$BIN_URL.sha512" ) \
Expand All @@ -11,4 +14,4 @@ RUN BIN_URL=https://storage.googleapis.com/kubernetes-release/release/v1.19.16/b
&& chmod +x /usr/local/bin/kubectl \
&& sha512sum /usr/local/bin/kubectl | grep "$SHA512"

CMD [ "/usr/local/bin/kubectl" ]
ENTRYPOINT [ "/docker-entrypoint.sh" ]
10 changes: 10 additions & 0 deletions variants/v1.19.16-alpine-3.8/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- kubectl "$@"
elif [ $# -gt 0 ] && kubectl "$1" --help > /dev/null 2>&1; then
set -- kubectl "$@"
fi

exec "$@"
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

# When $TARGETPLATFORM is linux/arm/v7, strip out the '/v6' or '/v7' from it
RUN BIN_URL=https://storage.googleapis.com/kubernetes-release/release/v1.19.16/bin/$( echo $TARGETPLATFORM | sed 's@/v[67]$@@' )/kubectl \
&& SHA512=$( wget -qO- "$BIN_URL.sha512" ) \
Expand Down Expand Up @@ -46,4 +49,4 @@ RUN apk add --no-cache gnupg

RUN apk add --no-cache openssh-client

CMD [ "/usr/local/bin/kubectl" ]
ENTRYPOINT [ "/docker-entrypoint.sh" ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -eu

if [ $# -gt 0 ] && [ "${1#-}" != "$1" ]; then
set -- kubectl "$@"
elif [ $# -gt 0 ] && kubectl "$1" --help > /dev/null 2>&1; then
set -- kubectl "$@"
fi

exec "$@"
5 changes: 4 additions & 1 deletion variants/v1.20.15-alpine-3.8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

# When $TARGETPLATFORM is linux/arm/v7, strip out the '/v6' or '/v7' from it
RUN BIN_URL=https://storage.googleapis.com/kubernetes-release/release/v1.20.15/bin/$( echo $TARGETPLATFORM | sed 's@/v[67]$@@' )/kubectl \
&& SHA512=$( wget -qO- "$BIN_URL.sha512" ) \
Expand All @@ -11,4 +14,4 @@ RUN BIN_URL=https://storage.googleapis.com/kubernetes-release/release/v1.20.15/b
&& chmod +x /usr/local/bin/kubectl \
&& sha512sum /usr/local/bin/kubectl | grep "$SHA512"

CMD [ "/usr/local/bin/kubectl" ]
ENTRYPOINT [ "/docker-entrypoint.sh" ]
Loading

0 comments on commit 9acdc63

Please sign in to comment.