diff --git a/1.3/Dockerfile b/1.3/Dockerfile index 8acc065..2f101d5 100644 --- a/1.3/Dockerfile +++ b/1.3/Dockerfile @@ -2,20 +2,24 @@ FROM java:8-jre # grab gosu for easy step-down from root RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 -RUN curl -o /usr/local/bin/gosu -fSL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture)" \ - && curl -o /usr/local/bin/gosu.asc -fSL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture).asc" \ +RUN arch="$(dpkg --print-architecture)" \ + && set -x \ + && curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.3/gosu-$arch" \ + && curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/1.3/gosu-$arch.asc" \ && gpg --verify /usr/local/bin/gosu.asc \ && rm /usr/local/bin/gosu.asc \ && chmod +x /usr/local/bin/gosu RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 46095ACC8548582C1A2699A9D27D666CD88E42B4 +ENV ELASTICSEARCH_MAJOR 1.3 ENV ELASTICSEARCH_VERSION 1.3.9 -RUN echo "deb http://packages.elasticsearch.org/elasticsearch/${ELASTICSEARCH_VERSION%.*}/debian stable main" > /etc/apt/sources.list.d/elasticsearch.list +RUN echo "deb http://packages.elasticsearch.org/elasticsearch/$ELASTICSEARCH_MAJOR/debian stable main" > /etc/apt/sources.list.d/elasticsearch.list -RUN apt-get update \ - && apt-get install elasticsearch=$ELASTICSEARCH_VERSION \ +RUN set -x \ + && apt-get update \ + && apt-get install -y --no-install-recommends elasticsearch=$ELASTICSEARCH_VERSION \ && rm -rf /var/lib/apt/lists/* ENV PATH /usr/share/elasticsearch/bin:$PATH diff --git a/1.4/Dockerfile b/1.4/Dockerfile index d8a47a4..3fcaaf1 100644 --- a/1.4/Dockerfile +++ b/1.4/Dockerfile @@ -2,20 +2,24 @@ FROM java:8-jre # grab gosu for easy step-down from root RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 -RUN curl -o /usr/local/bin/gosu -fSL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture)" \ - && curl -o /usr/local/bin/gosu.asc -fSL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture).asc" \ +RUN arch="$(dpkg --print-architecture)" \ + && set -x \ + && curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.3/gosu-$arch" \ + && curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/1.3/gosu-$arch.asc" \ && gpg --verify /usr/local/bin/gosu.asc \ && rm /usr/local/bin/gosu.asc \ && chmod +x /usr/local/bin/gosu RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 46095ACC8548582C1A2699A9D27D666CD88E42B4 +ENV ELASTICSEARCH_MAJOR 1.4 ENV ELASTICSEARCH_VERSION 1.4.5 -RUN echo "deb http://packages.elasticsearch.org/elasticsearch/${ELASTICSEARCH_VERSION%.*}/debian stable main" > /etc/apt/sources.list.d/elasticsearch.list +RUN echo "deb http://packages.elasticsearch.org/elasticsearch/$ELASTICSEARCH_MAJOR/debian stable main" > /etc/apt/sources.list.d/elasticsearch.list -RUN apt-get update \ - && apt-get install elasticsearch=$ELASTICSEARCH_VERSION \ +RUN set -x \ + && apt-get update \ + && apt-get install -y --no-install-recommends elasticsearch=$ELASTICSEARCH_VERSION \ && rm -rf /var/lib/apt/lists/* ENV PATH /usr/share/elasticsearch/bin:$PATH diff --git a/1.5/Dockerfile b/1.5/Dockerfile index 62bd7bd..48ded28 100644 --- a/1.5/Dockerfile +++ b/1.5/Dockerfile @@ -2,20 +2,24 @@ FROM java:8-jre # grab gosu for easy step-down from root RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 -RUN curl -o /usr/local/bin/gosu -fSL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture)" \ - && curl -o /usr/local/bin/gosu.asc -fSL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture).asc" \ +RUN arch="$(dpkg --print-architecture)" \ + && set -x \ + && curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.3/gosu-$arch" \ + && curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/1.3/gosu-$arch.asc" \ && gpg --verify /usr/local/bin/gosu.asc \ && rm /usr/local/bin/gosu.asc \ && chmod +x /usr/local/bin/gosu RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 46095ACC8548582C1A2699A9D27D666CD88E42B4 +ENV ELASTICSEARCH_MAJOR 1.5 ENV ELASTICSEARCH_VERSION 1.5.2 -RUN echo "deb http://packages.elasticsearch.org/elasticsearch/${ELASTICSEARCH_VERSION%.*}/debian stable main" > /etc/apt/sources.list.d/elasticsearch.list +RUN echo "deb http://packages.elasticsearch.org/elasticsearch/$ELASTICSEARCH_MAJOR/debian stable main" > /etc/apt/sources.list.d/elasticsearch.list -RUN apt-get update \ - && apt-get install elasticsearch=$ELASTICSEARCH_VERSION \ +RUN set -x \ + && apt-get update \ + && apt-get install -y --no-install-recommends elasticsearch=$ELASTICSEARCH_VERSION \ && rm -rf /var/lib/apt/lists/* ENV PATH /usr/share/elasticsearch/bin:$PATH diff --git a/1.6/Dockerfile b/1.6/Dockerfile index b185755..57cc1ef 100644 --- a/1.6/Dockerfile +++ b/1.6/Dockerfile @@ -2,20 +2,24 @@ FROM java:8-jre # grab gosu for easy step-down from root RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 -RUN curl -o /usr/local/bin/gosu -fSL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture)" \ - && curl -o /usr/local/bin/gosu.asc -fSL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture).asc" \ +RUN arch="$(dpkg --print-architecture)" \ + && set -x \ + && curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.3/gosu-$arch" \ + && curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/1.3/gosu-$arch.asc" \ && gpg --verify /usr/local/bin/gosu.asc \ && rm /usr/local/bin/gosu.asc \ && chmod +x /usr/local/bin/gosu RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 46095ACC8548582C1A2699A9D27D666CD88E42B4 +ENV ELASTICSEARCH_MAJOR 1.6 ENV ELASTICSEARCH_VERSION 1.6.2 -RUN echo "deb http://packages.elasticsearch.org/elasticsearch/${ELASTICSEARCH_VERSION%.*}/debian stable main" > /etc/apt/sources.list.d/elasticsearch.list +RUN echo "deb http://packages.elasticsearch.org/elasticsearch/$ELASTICSEARCH_MAJOR/debian stable main" > /etc/apt/sources.list.d/elasticsearch.list -RUN apt-get update \ - && apt-get install elasticsearch=$ELASTICSEARCH_VERSION \ +RUN set -x \ + && apt-get update \ + && apt-get install -y --no-install-recommends elasticsearch=$ELASTICSEARCH_VERSION \ && rm -rf /var/lib/apt/lists/* ENV PATH /usr/share/elasticsearch/bin:$PATH diff --git a/1.7/Dockerfile b/1.7/Dockerfile index e4148f6..f870e3b 100644 --- a/1.7/Dockerfile +++ b/1.7/Dockerfile @@ -2,20 +2,24 @@ FROM java:8-jre # grab gosu for easy step-down from root RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 -RUN curl -o /usr/local/bin/gosu -fSL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture)" \ - && curl -o /usr/local/bin/gosu.asc -fSL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture).asc" \ +RUN arch="$(dpkg --print-architecture)" \ + && set -x \ + && curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.3/gosu-$arch" \ + && curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/1.3/gosu-$arch.asc" \ && gpg --verify /usr/local/bin/gosu.asc \ && rm /usr/local/bin/gosu.asc \ && chmod +x /usr/local/bin/gosu RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 46095ACC8548582C1A2699A9D27D666CD88E42B4 +ENV ELASTICSEARCH_MAJOR 1.7 ENV ELASTICSEARCH_VERSION 1.7.1 -RUN echo "deb http://packages.elasticsearch.org/elasticsearch/${ELASTICSEARCH_VERSION%.*}/debian stable main" > /etc/apt/sources.list.d/elasticsearch.list +RUN echo "deb http://packages.elasticsearch.org/elasticsearch/$ELASTICSEARCH_MAJOR/debian stable main" > /etc/apt/sources.list.d/elasticsearch.list -RUN apt-get update \ - && apt-get install elasticsearch=$ELASTICSEARCH_VERSION \ +RUN set -x \ + && apt-get update \ + && apt-get install -y --no-install-recommends elasticsearch=$ELASTICSEARCH_VERSION \ && rm -rf /var/lib/apt/lists/* ENV PATH /usr/share/elasticsearch/bin:$PATH diff --git a/Dockerfile.template b/Dockerfile.template index 2cf9376..399d00e 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -2,20 +2,24 @@ FROM java:8-jre # grab gosu for easy step-down from root RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 -RUN curl -o /usr/local/bin/gosu -fSL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture)" \ - && curl -o /usr/local/bin/gosu.asc -fSL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture).asc" \ +RUN arch="$(dpkg --print-architecture)" \ + && set -x \ + && curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.3/gosu-$arch" \ + && curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/1.3/gosu-$arch.asc" \ && gpg --verify /usr/local/bin/gosu.asc \ && rm /usr/local/bin/gosu.asc \ && chmod +x /usr/local/bin/gosu RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 46095ACC8548582C1A2699A9D27D666CD88E42B4 -ENV ELASTICSEARCH_VERSION %%VERSION%% +ENV ELASTICSEARCH_MAJOR %%ELASTICSEARCH_MAJOR%% +ENV ELASTICSEARCH_VERSION %%ELASTICSEARCH_VERSION%% -RUN echo "deb http://packages.elasticsearch.org/elasticsearch/${ELASTICSEARCH_VERSION%.*}/debian stable main" > /etc/apt/sources.list.d/elasticsearch.list +RUN echo "deb http://packages.elasticsearch.org/elasticsearch/$ELASTICSEARCH_MAJOR/debian stable main" > /etc/apt/sources.list.d/elasticsearch.list -RUN apt-get update \ - && apt-get install elasticsearch=$ELASTICSEARCH_VERSION \ +RUN set -x \ + && apt-get update \ + && apt-get install -y --no-install-recommends elasticsearch=$ELASTICSEARCH_VERSION \ && rm -rf /var/lib/apt/lists/* ENV PATH /usr/share/elasticsearch/bin:$PATH diff --git a/update.sh b/update.sh index deb9749..2763c09 100755 --- a/update.sh +++ b/update.sh @@ -3,26 +3,30 @@ set -e cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" -versions=( */ ) +versions=( "$@" ) +if [ ${#versions[@]} -eq 0 ]; then + versions=( */ ) +fi versions=( "${versions[@]%/}" ) -downloadable=$({ - # get a few pages worth so we make sure to capture a decent number of releases - curl -fsSL 'https://www.elastic.co/downloads/past-releases' - curl -fsSL 'https://www.elastic.co/downloads/past-releases?page=2' - curl -fsSL 'https://www.elastic.co/downloads/past-releases?page=3' -} | sed -rn 's!.*?/downloads/past-releases/(elasticsearch-)?[0-9]+-[0-9]+-[0-9]+">Elasticsearch ([0-9]+\.[0-9]+\.[0-9]+)<.*!\2!gp') travisEnv= for version in "${versions[@]}"; do travisEnv='\n - VERSION='"$version$travisEnv" - recent=$(echo "$downloadable" | grep -m 1 "^$version" || true) - if [ -z "$recent" ]; then + fullVersion="$(curl -fsSL "http://packages.elasticsearch.org/elasticsearch/$version/debian/dists/stable/main/binary-amd64/Packages" | awk -F ': ' '$1 == "Package" { pkg = $2 } pkg == "elasticsearch" && $1 == "Version" { print $2 }' | sort -rV | head -n1)" + if [ -z "$fullVersion" ]; then echo >&2 "warning: cannot find full version for $version" continue fi - sed 's/%%VERSION%%/'"$recent"'/' "$version/Dockerfile" - cp -p docker-entrypoint.sh $version + ( + set -x + cp docker-entrypoint.sh Dockerfile.template "$version/" + mv "$version/Dockerfile.template" "$version/Dockerfile" + sed -i ' + s/%%ELASTICSEARCH_MAJOR%%/'"$version"'/g; + s/%%ELASTICSEARCH_VERSION%%/'"$fullVersion"'/g; + ' "$version/Dockerfile" + ) done travis="$(awk -v 'RS=\n\n' '$1 == "env:" { $0 = "env:'"$travisEnv"'" } { printf "%s%s", $0, RS }' .travis.yml)"