Skip to content

Commit

Permalink
Merge pull request vromero#91 from abedwardsw/feature/artemissrc
Browse files Browse the repository at this point in the history
add ability to override artemis binary distro url on build
  • Loading branch information
vromero authored Oct 9, 2018
2 parents e8bf009 + 868bbef commit 098de14
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 23 deletions.
2 changes: 2 additions & 0 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@ make 2.6.0-alpine

It is also possible to just build the image without testing with `make build_2.6.0`, just testing: `make test_2.6.0`, running the image: `make run_2.6.0` or even run the image for a shell `make runsh_2.6.0`.

You can also override the artemis binary distribution url by passing a parameter containing a zip file containing the distribution. ie. `make BUILD_ARGS="--build-arg ACTIVEMQ_DISTRIBUTION_URL=https://repository.apache.org/content/repositories/releases/org/apache/activemq/apache-artemis/2.6.3/apache-artemis-2.6.3-bin.zip" 2.6.3`. Note that you also need to pass in the version # as the first argument (ie 2.6.3)

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ TMP_DIR = $(shell DIR=$$(mktemp -d) && chmod 777 -R $${DIR} && echo $${DIR})

build_%:
cd src && \
docker build --build-arg ACTIVEMQ_ARTEMIS_VERSION=$(call versionFromTag,$*) -t $(call fullTagNameFromTag,$*) -f $(call dockerfileFromTag,$*) .
docker build --build-arg ACTIVEMQ_ARTEMIS_VERSION=$(call versionFromTag,$*) $(BUILD_ARGS) -t $(call fullTagNameFromTag,$*) -f $(call dockerfileFromTag,$*) .

test_%:
GOSS_FILES_PATH=$$(pwd)/test GOSS_VARS="vars.yaml" dgoss run -it --rm -h testHostName.local $(call fullTagNameFromTag,$*) && \
Expand Down
37 changes: 26 additions & 11 deletions src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ FROM openjdk:8u171-jdk-stretch as builder
LABEL maintainer="Victor Romero <[email protected]>"

ARG ACTIVEMQ_ARTEMIS_VERSION
ARG ACTIVEMQ_DISTRIBUTION_URL
ENV JMX_EXPORTER_VERSION=0.3.1
ENV JGROUPS_KUBERNETES_VERSION=0.9.3

Expand All @@ -22,20 +23,34 @@ RUN apt-get -qq -o=Dpkg::Use-Pty=0 update && \
wget=1.18-5+deb9u2 && \
rm -rf /var/lib/apt/lists/*

# Uncompress and validate
WORKDIR /opt
RUN wget "https://repository.apache.org/content/repositories/releases/org/apache/activemq/apache-artemis/${ACTIVEMQ_ARTEMIS_VERSION}/apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}-bin.tar.gz" && \
wget "https://repository.apache.org/content/repositories/releases/org/apache/activemq/apache-artemis/${ACTIVEMQ_ARTEMIS_VERSION}/apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}-bin.tar.gz.asc" && \
wget "http://apache.org/dist/activemq/KEYS" && \
gpg --import "KEYS" && \
gpg "apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}-bin.tar.gz.asc" && \
tar xfz "apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}-bin.tar.gz" && \
ln -s "/opt/apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}" "/opt/apache-artemis" && \
rm -f "apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}-bin.tar.gz" "KEYS" "apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}-bin.tar.gz.asc"

# Make sure pipes are considered to detemine success, see: https://github.com/hadolint/hadolint/wiki/DL4006
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# Uncompress and validate
WORKDIR /opt
RUN if (echo "${ACTIVEMQ_DISTRIBUTION_URL}" | grep -Eq ".zip\$" ) ; \
then \
mkdir tmp && \
wget "${ACTIVEMQ_DISTRIBUTION_URL}" -P tmp/ && \
unzip -d tmp -q "tmp/*.zip" && rm -f tmp/*.zip && ls -l tmp/ && \
mv tmp/* ./apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION} && \
ln -s "/opt/apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}" "/opt/apache-artemis" && \
rmdir tmp; \
elif test -n "${ACTIVEMQ_DISTRIBUTION_URL}" ; \
then \
echo "Only .zip format is supported when using ACTIVEMQ_DISTRIBUTION_URL" && \
exit 2; \
else \
wget "https://repository.apache.org/content/repositories/releases/org/apache/activemq/apache-artemis/${ACTIVEMQ_ARTEMIS_VERSION}/apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}-bin.tar.gz" && \
wget "https://repository.apache.org/content/repositories/releases/org/apache/activemq/apache-artemis/${ACTIVEMQ_ARTEMIS_VERSION}/apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}-bin.tar.gz.asc" && \
wget "http://apache.org/dist/activemq/KEYS" && \
gpg --import "KEYS" && \
gpg "apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}-bin.tar.gz.asc" && \
tar xfz "apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}-bin.tar.gz" && \
ln -s "/opt/apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}" "/opt/apache-artemis" && \
rm -f "apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}-bin.tar.gz" "KEYS" "apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}-bin.tar.gz.asc"; \
fi

# Create broker instance
# Per recommendation of https://activemq.apache.org/artemis/docs/latest/perf-tuning.html : -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -XX:+UseParallelOldGC
WORKDIR /var/lib
Expand Down
37 changes: 26 additions & 11 deletions src/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ FROM openjdk:8 as builder
LABEL maintainer="Victor Romero <[email protected]>"

ARG ACTIVEMQ_ARTEMIS_VERSION
ARG ACTIVEMQ_DISTRIBUTION_URL
ENV JMX_EXPORTER_VERSION=0.3.1
ENV JGROUPS_KUBERNETES_VERSION=0.9.3

Expand All @@ -22,20 +23,34 @@ RUN apt-get -qq -o=Dpkg::Use-Pty=0 update && \
wget=1.18-5+deb9u2 && \
rm -rf /var/lib/apt/lists/*

# Uncompress and validate
WORKDIR /opt
RUN wget "https://repository.apache.org/content/repositories/releases/org/apache/activemq/apache-artemis/${ACTIVEMQ_ARTEMIS_VERSION}/apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}-bin.tar.gz" && \
wget "https://repository.apache.org/content/repositories/releases/org/apache/activemq/apache-artemis/${ACTIVEMQ_ARTEMIS_VERSION}/apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}-bin.tar.gz.asc" && \
wget "http://apache.org/dist/activemq/KEYS" && \
gpg --import "KEYS" && \
gpg "apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}-bin.tar.gz.asc" && \
tar xfz "apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}-bin.tar.gz" && \
ln -s "/opt/apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}" "/opt/apache-artemis" && \
rm -f "apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}-bin.tar.gz" "KEYS" "apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}-bin.tar.gz.asc"

# Make sure pipes are considered to detemine success, see: https://github.com/hadolint/hadolint/wiki/DL4006
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# Uncompress and validate
WORKDIR /opt
RUN if (echo "${ACTIVEMQ_DISTRIBUTION_URL}" | grep -Eq ".zip\$" ) ; \
then \
mkdir tmp && \
wget "${ACTIVEMQ_DISTRIBUTION_URL}" -P tmp/ && \
unzip -d tmp -q "tmp/*.zip" && rm -f tmp/*.zip && ls -l tmp/ && \
mv tmp/* ./apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION} && \
ln -s "/opt/apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}" "/opt/apache-artemis" && \
rmdir tmp; \
elif test -n "${ACTIVEMQ_DISTRIBUTION_URL}" ; \
then \
echo "Only .zip format is supported when using ACTIVEMQ_DISTRIBUTION_URL" && \
exit 2; \
else \
wget "https://repository.apache.org/content/repositories/releases/org/apache/activemq/apache-artemis/${ACTIVEMQ_ARTEMIS_VERSION}/apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}-bin.tar.gz" && \
wget "https://repository.apache.org/content/repositories/releases/org/apache/activemq/apache-artemis/${ACTIVEMQ_ARTEMIS_VERSION}/apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}-bin.tar.gz.asc" && \
wget "http://apache.org/dist/activemq/KEYS" && \
gpg --import "KEYS" && \
gpg "apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}-bin.tar.gz.asc" && \
tar xfz "apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}-bin.tar.gz" && \
ln -s "/opt/apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}" "/opt/apache-artemis" && \
rm -f "apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}-bin.tar.gz" "KEYS" "apache-artemis-${ACTIVEMQ_ARTEMIS_VERSION}-bin.tar.gz.asc"; \
fi

# Create broker instance
# Per recommendation of https://activemq.apache.org/artemis/docs/latest/perf-tuning.html : -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -XX:+UseParallelOldGC
WORKDIR /var/lib
Expand Down

0 comments on commit 098de14

Please sign in to comment.