From a11db1597f9be5365028673df4d05b2ea854b3ed Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Wed, 16 Mar 2016 10:16:51 -0700 Subject: [PATCH] Add "reload" support to Alpine by converting the docker-entrypoint.sh to POSIX --- 1.4/alpine/Dockerfile | 2 ++ 1.4/alpine/docker-entrypoint.sh | 9 +++++++++ 1.4/docker-entrypoint.sh | 6 +++--- 1.5/alpine/Dockerfile | 2 ++ 1.5/alpine/docker-entrypoint.sh | 15 +++++++++++++++ 1.5/docker-entrypoint.sh | 6 +++--- 1.6/alpine/Dockerfile | 2 ++ 1.6/alpine/docker-entrypoint.sh | 15 +++++++++++++++ 1.6/docker-entrypoint.sh | 6 +++--- 9 files changed, 54 insertions(+), 9 deletions(-) create mode 100755 1.4/alpine/docker-entrypoint.sh create mode 100755 1.5/alpine/docker-entrypoint.sh create mode 100755 1.6/alpine/docker-entrypoint.sh diff --git a/1.4/alpine/Dockerfile b/1.4/alpine/Dockerfile index 6d53d32..7ebe30d 100644 --- a/1.4/alpine/Dockerfile +++ b/1.4/alpine/Dockerfile @@ -41,4 +41,6 @@ RUN set -x \ && apk add --virtual .haproxy-rundeps $runDeps \ && apk del .build-deps +COPY docker-entrypoint.sh / +ENTRYPOINT ["/docker-entrypoint.sh"] CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"] diff --git a/1.4/alpine/docker-entrypoint.sh b/1.4/alpine/docker-entrypoint.sh new file mode 100755 index 0000000..06c4dfa --- /dev/null +++ b/1.4/alpine/docker-entrypoint.sh @@ -0,0 +1,9 @@ +#!/bin/sh +set -e + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- haproxy "$@" +fi + +exec "$@" diff --git a/1.4/docker-entrypoint.sh b/1.4/docker-entrypoint.sh index cb8b89c..06c4dfa 100755 --- a/1.4/docker-entrypoint.sh +++ b/1.4/docker-entrypoint.sh @@ -1,8 +1,8 @@ -#!/bin/bash -set -eo pipefail +#!/bin/sh +set -e # first arg is `-f` or `--some-option` -if [ "${1:0:1}" = '-' ]; then +if [ "${1#-}" != "$1" ]; then set -- haproxy "$@" fi diff --git a/1.5/alpine/Dockerfile b/1.5/alpine/Dockerfile index 86ebc4b..5c047ed 100644 --- a/1.5/alpine/Dockerfile +++ b/1.5/alpine/Dockerfile @@ -41,4 +41,6 @@ RUN set -x \ && apk add --virtual .haproxy-rundeps $runDeps \ && apk del .build-deps +COPY docker-entrypoint.sh / +ENTRYPOINT ["/docker-entrypoint.sh"] CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"] diff --git a/1.5/alpine/docker-entrypoint.sh b/1.5/alpine/docker-entrypoint.sh new file mode 100755 index 0000000..1b413a9 --- /dev/null +++ b/1.5/alpine/docker-entrypoint.sh @@ -0,0 +1,15 @@ +#!/bin/sh +set -e + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- haproxy "$@" +fi + +if [ "$1" = 'haproxy' ]; then + # if the user wants "haproxy", let's use "haproxy-systemd-wrapper" instead so we can have proper reloadability implemented by upstream + shift # "haproxy" + set -- "$(which haproxy-systemd-wrapper)" -p /run/haproxy.pid "$@" +fi + +exec "$@" diff --git a/1.5/docker-entrypoint.sh b/1.5/docker-entrypoint.sh index e242db2..1b413a9 100755 --- a/1.5/docker-entrypoint.sh +++ b/1.5/docker-entrypoint.sh @@ -1,8 +1,8 @@ -#!/bin/bash -set -eo pipefail +#!/bin/sh +set -e # first arg is `-f` or `--some-option` -if [ "${1:0:1}" = '-' ]; then +if [ "${1#-}" != "$1" ]; then set -- haproxy "$@" fi diff --git a/1.6/alpine/Dockerfile b/1.6/alpine/Dockerfile index 2fcfcc4..00c4507 100644 --- a/1.6/alpine/Dockerfile +++ b/1.6/alpine/Dockerfile @@ -41,4 +41,6 @@ RUN set -x \ && apk add --virtual .haproxy-rundeps $runDeps \ && apk del .build-deps +COPY docker-entrypoint.sh / +ENTRYPOINT ["/docker-entrypoint.sh"] CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"] diff --git a/1.6/alpine/docker-entrypoint.sh b/1.6/alpine/docker-entrypoint.sh new file mode 100755 index 0000000..1b413a9 --- /dev/null +++ b/1.6/alpine/docker-entrypoint.sh @@ -0,0 +1,15 @@ +#!/bin/sh +set -e + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- haproxy "$@" +fi + +if [ "$1" = 'haproxy' ]; then + # if the user wants "haproxy", let's use "haproxy-systemd-wrapper" instead so we can have proper reloadability implemented by upstream + shift # "haproxy" + set -- "$(which haproxy-systemd-wrapper)" -p /run/haproxy.pid "$@" +fi + +exec "$@" diff --git a/1.6/docker-entrypoint.sh b/1.6/docker-entrypoint.sh index e242db2..1b413a9 100755 --- a/1.6/docker-entrypoint.sh +++ b/1.6/docker-entrypoint.sh @@ -1,8 +1,8 @@ -#!/bin/bash -set -eo pipefail +#!/bin/sh +set -e # first arg is `-f` or `--some-option` -if [ "${1:0:1}" = '-' ]; then +if [ "${1#-}" != "$1" ]; then set -- haproxy "$@" fi