|
| 1 | +# Copyright 2019 HAProxy Technologies LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +FROM haproxytech/haproxy-alpine:2.7 |
| 16 | + |
| 17 | +ARG TARGETPLATFORM |
| 18 | + |
| 19 | +ARG S6_OVERLAY_VERSION=2.2.0.3 |
| 20 | +ENV S6_OVERLAY_VERSION $S6_OVERLAY_VERSION |
| 21 | +ENV S6_READ_ONLY_ROOT=1 |
| 22 | + |
| 23 | +COPY /fs / |
| 24 | + |
| 25 | +RUN apk --no-cache add socat openssl util-linux htop tzdata curl libcap && \ |
| 26 | + rm -f /usr/local/bin/dataplaneapi /usr/bin/dataplaneapi && \ |
| 27 | + chgrp -R haproxy /usr/local/etc/haproxy /run /var && \ |
| 28 | + chmod -R ug+rwx /usr/local/etc/haproxy /run /var && \ |
| 29 | + setcap 'cap_net_bind_service=+ep' /usr/local/sbin/haproxy && \ |
| 30 | + case "${TARGETPLATFORM}" in \ |
| 31 | + "linux/arm64") S6_ARCH=aarch64 ;; \ |
| 32 | + "linux/amd64") S6_ARCH=amd64 ;; \ |
| 33 | + "linux/arm/v6") S6_ARCH=arm ;; \ |
| 34 | + "linux/arm/v7") S6_ARCH=armhf ;; \ |
| 35 | + "linux/ppc64le") S6_ARCH=ppc64le ;; \ |
| 36 | + "linux/386") S6_ARCH=x86 ;; \ |
| 37 | + *) echo "ARG TARGETPLATFORM undeclared" >&2 && exit 1 ;; \ |
| 38 | + esac && \ |
| 39 | + curl -sS -L -o /tmp/s6-overlay-installer "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_ARCH}-installer" && \ |
| 40 | + chmod +x /tmp/s6-overlay-installer && \ |
| 41 | + /tmp/s6-overlay-installer / && \ |
| 42 | + rm -f /tmp/s6-overlay-installer && \ |
| 43 | + mkdir /var/run/s6 && \ |
| 44 | + chown haproxy:haproxy /var/run/s6 && \ |
| 45 | + chmod ug+rwx /var/run/s6 && \ |
| 46 | + sed -i 's/ root / haproxy /g' /etc/s6/init/init-stage2-fixattrs.txt && \ |
| 47 | + chmod ugo+x /etc/services.d/*/run /etc/cont-init.d/* && \ |
| 48 | + rm -rf /var/lib/pebble |
| 49 | + |
| 50 | +COPY kubernetes-ingress ./haproxy-ingress-controller |
| 51 | + |
| 52 | +ENTRYPOINT ["/start.sh"] |
0 commit comments