forked from kubernetes/ingress-nginx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add debug to options to branch 1.5.1-0.5 (kubernetes#27)
* add debug info * My empty commit with a message
- Loading branch information
1 parent
69eec14
commit 20ecce7
Showing
5 changed files
with
163 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash -e | ||
|
||
BASEDIR="$(realpath "$(dirname "$0")/..")" | ||
GODIR_ROOT="$BASEDIR/cmd" | ||
|
||
#### PREPARE | ||
rm -rf "${BASEDIR}/dist" | ||
mkdir "${BASEDIR}/dist" | ||
|
||
if [[ -z "$1" ]]; then | ||
VERSION=$(cat $BASEDIR/VERSION) | ||
else | ||
VERSION=$1 | ||
fi | ||
|
||
export GOPATH="${BASEDIR}/dist" | ||
export HOME="${BASEDIR}/go" | ||
|
||
echo "Building and downloading dlv..." | ||
mkdir ${BASEDIR}/dist/delve | ||
git clone https://github.com/go-delve/delve.git ${BASEDIR}/dist/delve | ||
cd ${BASEDIR}/dist/delve/cmd/dlv | ||
CGO_ENABLED=0 go build -ldflags "-s -w -extldflags '-static'" -o "${BASEDIR}/dist/dlv" | ||
|
||
cd "$GODIR_ROOT/nginx" | ||
echo "Building ingress-nginx nginx-ingress-controller..." | ||
CGO_ENABLED=0 GOOS=linux /usr/local/go/bin/go build -buildvcs=false -gcflags "all=-N -l" -o "${BASEDIR}/dist/nginx-ingress-controller" ${GODIR_ROOT}/nginx | ||
echo "Cleaning ingress-nginx nginx dependencies..." | ||
/usr/local/go/bin/go clean -modcache | ||
|
||
cd "$GODIR_ROOT/dbg" | ||
echo "Building ingress-nginx dbg..." | ||
CGO_ENABLED=0 GOOS=linux /usr/local/go/bin/go build -buildvcs=false -gcflags "-N -l" -o "${BASEDIR}/dist/dbg" ${GODIR_ROOT}/dbg | ||
echo "Cleaning ingress-nginx dbg dependencies..." | ||
/usr/local/go/bin/go clean -modcache | ||
|
||
cd "$GODIR_ROOT/waitshutdown" | ||
echo "Building ingress-nginx wait-shutdown..." | ||
CGO_ENABLED=0 GOOS=linux /usr/local/go/bin/go build -buildvcs=false -gcflags "all=-N -l" -o "${BASEDIR}/dist/wait-shutdown" ${GODIR_ROOT}/waitshutdown | ||
echo "Cleaning ingress-nginx waitshutdown dependencies..." | ||
/usr/local/go/bin/go clean -modcache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
# Copyright 2015 The Kubernetes Authors. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
|
||
|
||
FROM qa.int.stratio.com/ingress-nginx/nginx:81c2afd975a6f9a9847184472286044d7d5296f6@sha256:a71ac64dd8cfd68341ba47dbdc4d8c2cb91325fce669875193ea0319118201b5 | ||
|
||
|
||
WORKDIR /etc/nginx | ||
|
||
RUN apk update \ | ||
&& apk upgrade \ | ||
&& apk add --no-cache \ | ||
&& apk upgrade openssl --repository=https://dl-cdn.alpinelinux.org/alpine/v3.14/main \ | ||
&& apk add make --repository=https://dl-cdn.alpinelinux.org/alpine/v3.14/main \ | ||
diffutils make unzip \ | ||
&& apk upgrade libxml2 \ | ||
&& apk add --no-cache libc6-compat \ | ||
&& apk add gdb \ | ||
&& rm -rf /var/cache/apk/* | ||
|
||
# JWT manipulation dependencies | ||
ENV LUAROCKS_VERSION 3.8.0 | ||
ENV LUAROCKS_SHA ab6612ca9ab87c6984871d2712d05525775e8b50172701a0a1cabddf76de2be7 | ||
|
||
|
||
RUN wget -O /tmp/luarocks.tgz \ | ||
https://github.com/luarocks/luarocks/archive/v${LUAROCKS_VERSION}.tar.gz \ | ||
&& echo "${LUAROCKS_SHA} */tmp/luarocks.tgz" | sha256sum -c - \ | ||
&& tar -C /tmp -xzf /tmp/luarocks.tgz \ | ||
&& cd /tmp/luarocks* \ | ||
&& ./configure \ | ||
&& make install | ||
|
||
RUN luarocks install lua-resty-jwt | ||
# End manipulation dependencies | ||
|
||
|
||
|
||
COPY rootfs/etc /etc | ||
RUN chown -R root:root /etc/nginx | ||
|
||
|
||
COPY rootfs/etc /etc | ||
RUN chown -R www-data:www-data /etc/nginx | ||
|
||
COPY dist/dbg / | ||
RUN chown -R www-data:www-data /dbg | ||
COPY dist/nginx-ingress-controller / | ||
RUN chown -R www-data:www-data /nginx-ingress-controller | ||
COPY dist/wait-shutdown / | ||
RUN chown -R www-data:www-data /wait-shutdown | ||
COPY dist/dlv / | ||
RUN chown -R www-data:www-data /dlv | ||
|
||
# Fix permission during the build to avoid issues at runtime | ||
# with volumes (custom templates) | ||
RUN bash -xeu -c ' \ | ||
writeDirs=( \ | ||
/etc/ingress-controller \ | ||
/etc/ingress-controller/ssl \ | ||
/etc/ingress-controller/auth \ | ||
/var/log \ | ||
/var/log/nginx \ | ||
/tmp/nginx \ | ||
); \ | ||
for dir in "${writeDirs[@]}"; do \ | ||
mkdir -p ${dir}; \ | ||
chown -R www-data.www-data ${dir}; \ | ||
done' | ||
|
||
RUN apk add --no-cache libcap \ | ||
&& setcap cap_net_bind_service=+ep /nginx-ingress-controller \ | ||
&& setcap -v cap_net_bind_service=+ep /nginx-ingress-controller \ | ||
&& setcap cap_net_bind_service=+ep /usr/local/nginx/sbin/nginx \ | ||
&& setcap -v cap_net_bind_service=+ep /usr/local/nginx/sbin/nginx \ | ||
&& setcap cap_net_bind_service=+ep /usr/bin/dumb-init \ | ||
&& setcap -v cap_net_bind_service=+ep /usr/bin/dumb-init \ | ||
&& setcap cap_sys_admin,cap_sys_ptrace=+ep /dlv \ | ||
&& setcap -v cap_sys_admin,cap_sys_ptrace=+ep /dlv \ | ||
&& setcap cap_net_bind_service=+ep /dlv \ | ||
&& setcap -v cap_net_bind_service=+ep /dlv \ | ||
&& apk del libcap \ | ||
&& ln -sf /usr/local/nginx/sbin/nginx /usr/bin/nginx | ||
|
||
|
||
USER www-data | ||
|
||
# Create symlinks to redirect nginx logs to stdout and stderr docker log collector | ||
RUN ln -sf /dev/stdout /var/log/nginx/access.log \ | ||
&& ln -sf /dev/stderr /var/log/nginx/error.log | ||
|
||
ENTRYPOINT ["/usr/bin/dumb-init", "--"] | ||
|
||
|
||
CMD ["/nginx-ingress-controller"] |