Skip to content

Ensure "rabbitmqadmin" is extracted and ready for use in the management image variants #208

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

Merged
merged 2 commits into from
Nov 16, 2017
Merged
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
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ install:

before_script:
- env | sort
- cd "$VERSION"
- image="rabbitmq:$VERSION-$VARIANT"
- cd "$VERSION/$VARIANT"
- image="$(awk 'toupper($1) == "FROM" { print $2; exit }' management/Dockerfile)"

script:
- travis_retry docker build -t "$image" "$VARIANT"
- travis_retry docker build -t "$image" .
- ~/official-images/test/run.sh "$image"
- travis_retry docker build -t "${image}-management" "$VARIANT/management"
- travis_retry docker build -t "${image}-management" management
- ~/official-images/test/run.sh "${image}-management"

after_script:
Expand Down
24 changes: 23 additions & 1 deletion 3.6/alpine/management/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
FROM rabbitmq:alpine
FROM rabbitmq:3.6-alpine

RUN rabbitmq-plugins enable --offline rabbitmq_management

# extract "rabbitmqadmin" from inside the "rabbitmq_management-X.Y.Z.ez" plugin zipfile
# see https://github.com/docker-library/rabbitmq/issues/207
RUN set -eux; \
erl -noinput -eval ' \
{ ok, AdminBin } = zip:foldl(fun(FileInArchive, GetInfo, GetBin, Acc) -> \
case Acc of \
"" -> \
case lists:suffix("/rabbitmqadmin", FileInArchive) of \
true -> GetBin(); \
false -> Acc \
end; \
_ -> Acc \
end \
end, "", init:get_plain_arguments()), \
io:format("~s", [ AdminBin ]), \
init:stop(). \
' -- /plugins/rabbitmq_management-*.ez > /usr/local/bin/rabbitmqadmin; \
[ -s /usr/local/bin/rabbitmqadmin ]; \
chmod +x /usr/local/bin/rabbitmqadmin; \
apk add --no-cache python; \
rabbitmqadmin --version

EXPOSE 15671 15672
26 changes: 25 additions & 1 deletion 3.6/debian/management/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
FROM rabbitmq
FROM rabbitmq:3.6

RUN rabbitmq-plugins enable --offline rabbitmq_management

# extract "rabbitmqadmin" from inside the "rabbitmq_management-X.Y.Z.ez" plugin zipfile
# see https://github.com/docker-library/rabbitmq/issues/207
RUN set -eux; \
erl -noinput -eval ' \
{ ok, AdminBin } = zip:foldl(fun(FileInArchive, GetInfo, GetBin, Acc) -> \
case Acc of \
"" -> \
case lists:suffix("/rabbitmqadmin", FileInArchive) of \
true -> GetBin(); \
false -> Acc \
end; \
_ -> Acc \
end \
end, "", init:get_plain_arguments()), \
io:format("~s", [ AdminBin ]), \
init:stop(). \
' -- /plugins/rabbitmq_management-*.ez > /usr/local/bin/rabbitmqadmin; \
[ -s /usr/local/bin/rabbitmqadmin ]; \
chmod +x /usr/local/bin/rabbitmqadmin; \
apt-get update; \
apt-get install -y --no-install-recommends python; \
rm -rf /var/lib/apt/lists/*; \
rabbitmqadmin --version

EXPOSE 15671 15672