diff --git a/mcrouter/scripts/docker/Dockerfile.ubuntu-packaged b/mcrouter/scripts/docker/Dockerfile.ubuntu-packaged new file mode 100644 index 000000000..ac02b584e --- /dev/null +++ b/mcrouter/scripts/docker/Dockerfile.ubuntu-packaged @@ -0,0 +1,39 @@ +FROM ubuntu:xenial + +RUN set -xe \ + && buildDeps=" \ + wget \ + apt-transport-https" \ + && DEBIAN_FRONTEND=noninteractive \ + apt-get update \ + && apt-get install -y $buildDeps + + +COPY ["container/ubuntu-packaged/entrypoint.sh", \ + "/usr/local/bin/" \ + ] + +COPY ["container/ubuntu-packaged/10-mcrouter.list", \ + "/etc/apt/sources.list.d/" \ + ] + +COPY ["container/ubuntu-packaged/mcrouter.json", \ + "/etc/mcrouter/" \ + ] + + + +RUN wget -qO- \ + https://facebook.github.io/mcrouter/debrepo/xenial/PUBLIC.KEY \ + | apt-key add \ + && DEBIAN_FRONTEND=noninteractive \ + apt-get update \ + && \ + apt-get install -yq mcrouter --no-install-recommends \ + && apt-get purge -y --autoremove -o APT::AutoRemove::RecommendsImportant=false wget apt-transport-https \ + && apt-get autoremove && apt-get autoclean && rm -rf /var/lib/apt-lists/* + + +ENV MCROUTER_LISTEN_PORT 5000 + +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] diff --git a/mcrouter/scripts/docker/container/ubuntu-packaged/10-mcrouter.list b/mcrouter/scripts/docker/container/ubuntu-packaged/10-mcrouter.list new file mode 100644 index 000000000..f18bfff75 --- /dev/null +++ b/mcrouter/scripts/docker/container/ubuntu-packaged/10-mcrouter.list @@ -0,0 +1 @@ +deb https://facebook.github.io/mcrouter/debrepo/xenial xenial contrib diff --git a/mcrouter/scripts/docker/container/ubuntu-packaged/entrypoint.sh b/mcrouter/scripts/docker/container/ubuntu-packaged/entrypoint.sh new file mode 100755 index 000000000..ff847c712 --- /dev/null +++ b/mcrouter/scripts/docker/container/ubuntu-packaged/entrypoint.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +set -o errexit + + +function run_mcrouter() { + local CONFIG_PATH=$1 + mcrouter \ + --config file:${CONFIG_PATH} \ + -p "${MCROUTER_LISTEN_PORT:-5000}" \ + "$@" +} + + +if [ -z "${MCROUTER_CONFIG_PATH}" ]; then + echo "MCROUTER_CONFIG_PATH undefined! Using bundled default ..." + export MCROUTER_CONFIG_PATH=/etc/mcrouter/mcrouter.json +fi + +run_mcrouter "${MCROUTER_CONFIG_PATH}" "$@" diff --git a/mcrouter/scripts/docker/container/ubuntu-packaged/mcrouter.json b/mcrouter/scripts/docker/container/ubuntu-packaged/mcrouter.json new file mode 100644 index 000000000..fef6236fb --- /dev/null +++ b/mcrouter/scripts/docker/container/ubuntu-packaged/mcrouter.json @@ -0,0 +1,10 @@ +{ + "pools": { + "A": { + "servers": [ + "127.0.0.1:5001" + ] + } + }, + "route": "PoolRoute|A" +}