Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Create a more user-friendly Dockerfile for images. #310

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions mcrouter/scripts/docker/Dockerfile.ubuntu-packaged
Original file line number Diff line number Diff line change
@@ -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"]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deb https://facebook.github.io/mcrouter/debrepo/xenial xenial contrib
19 changes: 19 additions & 0 deletions mcrouter/scripts/docker/container/ubuntu-packaged/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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}" "$@"
10 changes: 10 additions & 0 deletions mcrouter/scripts/docker/container/ubuntu-packaged/mcrouter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"pools": {
"A": {
"servers": [
"127.0.0.1:5001"
]
}
},
"route": "PoolRoute|A"
}