File tree 7 files changed +119
-4
lines changed 7 files changed +119
-4
lines changed Original file line number Diff line number Diff line change 1
1
FROM java:7-jre
2
2
3
+ # grab gosu for easy step-down from root
4
+ RUN gpg --keyserver pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4
5
+ RUN curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture)" \
6
+ && curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture).asc" \
7
+ && gpg --verify /usr/local/bin/gosu.asc \
8
+ && rm /usr/local/bin/gosu.asc \
9
+ && chmod +x /usr/local/bin/gosu
10
+
3
11
RUN apt-key adv --keyserver pool.sks-keyservers.net --recv-keys 46095ACC8548582C1A2699A9D27D666CD88E42B4
4
12
5
13
ENV ELASTICSEARCH_VERSION 1.3.9
@@ -15,7 +23,10 @@ COPY config /usr/share/elasticsearch/config
15
23
16
24
VOLUME /usr/share/elasticsearch/data
17
25
26
+ COPY docker-entrypoint.sh /
27
+
28
+ ENTRYPOINT ["/docker-entrypoint.sh" ]
29
+
18
30
EXPOSE 9200 9300
19
31
20
32
CMD ["elasticsearch" ]
21
-
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -e
4
+
5
+ # Add elasticsearch as command if needed
6
+ if [ " ${1: 0: 1} " = ' -' ]; then
7
+ set -- elasticsearch " $@ "
8
+ fi
9
+
10
+ # Drop root privileges if we are running elasticsearch
11
+ if [ " $1 " = ' elasticsearch' ]; then
12
+ # Change the ownership of /usr/share/elasticsearch/data to elasticsearch
13
+ chown -R elasticsearch:elasticsearch /usr/share/elasticsearch/data
14
+ exec gosu elasticsearch " $@ "
15
+ fi
16
+
17
+ # As argument is not related to elasticsearch,
18
+ # then assume that user wants to run his own process,
19
+ # for example a `bash` shell to explore this image
20
+ exec " $@ "
Original file line number Diff line number Diff line change 1
1
FROM java:7-jre
2
2
3
+ # grab gosu for easy step-down from root
4
+ RUN gpg --keyserver pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4
5
+ RUN curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture)" \
6
+ && curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture).asc" \
7
+ && gpg --verify /usr/local/bin/gosu.asc \
8
+ && rm /usr/local/bin/gosu.asc \
9
+ && chmod +x /usr/local/bin/gosu
10
+
3
11
RUN apt-key adv --keyserver pool.sks-keyservers.net --recv-keys 46095ACC8548582C1A2699A9D27D666CD88E42B4
4
12
5
13
ENV ELASTICSEARCH_VERSION 1.4.4
@@ -15,7 +23,10 @@ COPY config /usr/share/elasticsearch/config
15
23
16
24
VOLUME /usr/share/elasticsearch/data
17
25
26
+ COPY docker-entrypoint.sh /
27
+
28
+ ENTRYPOINT ["/docker-entrypoint.sh" ]
29
+
18
30
EXPOSE 9200 9300
19
31
20
32
CMD ["elasticsearch" ]
21
-
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -e
4
+
5
+ # Add elasticsearch as command if needed
6
+ if [ " ${1: 0: 1} " = ' -' ]; then
7
+ set -- elasticsearch " $@ "
8
+ fi
9
+
10
+ # Drop root privileges if we are running elasticsearch
11
+ if [ " $1 " = ' elasticsearch' ]; then
12
+ # Change the ownership of /usr/share/elasticsearch/data to elasticsearch
13
+ chown -R elasticsearch:elasticsearch /usr/share/elasticsearch/data
14
+ exec gosu elasticsearch " $@ "
15
+ fi
16
+
17
+ # As argument is not related to elasticsearch,
18
+ # then assume that user wants to run his own process,
19
+ # for example a `bash` shell to explore this image
20
+ exec " $@ "
Original file line number Diff line number Diff line change
1
+ FROM java:7-jre
2
+
3
+ # grab gosu for easy step-down from root
4
+ RUN gpg --keyserver pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4
5
+ RUN curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture)" \
6
+ && curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture).asc" \
7
+ && gpg --verify /usr/local/bin/gosu.asc \
8
+ && rm /usr/local/bin/gosu.asc \
9
+ && chmod +x /usr/local/bin/gosu
10
+
11
+ RUN apt-key adv --keyserver pool.sks-keyservers.net --recv-keys 46095ACC8548582C1A2699A9D27D666CD88E42B4
12
+
13
+ ENV ELASTICSEARCH_VERSION %%VERSION%%
14
+
15
+ RUN echo "deb http://packages.elasticsearch.org/elasticsearch/${ELASTICSEARCH_VERSION%.*}/debian stable main" > /etc/apt/sources.list.d/elasticsearch.list
16
+
17
+ RUN apt-get update \
18
+ && apt-get install elasticsearch=$ELASTICSEARCH_VERSION \
19
+ && rm -rf /var/lib/apt/lists/*
20
+
21
+ ENV PATH /usr/share/elasticsearch/bin:$PATH
22
+ COPY config /usr/share/elasticsearch/config
23
+
24
+ VOLUME /usr/share/elasticsearch/data
25
+
26
+ COPY docker-entrypoint.sh /
27
+
28
+ ENTRYPOINT ["/docker-entrypoint.sh"]
29
+
30
+ EXPOSE 9200 9300
31
+
32
+ CMD ["elasticsearch"]
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -e
4
+
5
+ # Add elasticsearch as command if needed
6
+ if [ " ${1: 0: 1} " = ' -' ]; then
7
+ set -- elasticsearch " $@ "
8
+ fi
9
+
10
+ # Drop root privileges if we are running elasticsearch
11
+ if [ " $1 " = ' elasticsearch' ]; then
12
+ # Change the ownership of /usr/share/elasticsearch/data to elasticsearch
13
+ chown -R elasticsearch:elasticsearch /usr/share/elasticsearch/data
14
+ exec gosu elasticsearch " $@ "
15
+ fi
16
+
17
+ # As argument is not related to elasticsearch,
18
+ # then assume that user wants to run his own process,
19
+ # for example a `bash` shell to explore this image
20
+ exec " $@ "
Original file line number Diff line number Diff line change @@ -5,9 +5,10 @@ cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
5
5
6
6
versions=( * / )
7
7
versions=( " ${versions[@]%/ } " )
8
- downloadable=$( curl -sSL ' http ://www.elasticsearch.org /downloads' | sed -rn ' s!.*?http://www.elasticsearch.org/ downloads/[0-9]+-[0-9]+-[0-9]+/">Download v ([0-9]+\.[0-9]+\.[0-9]+)<.*!\1!gp' )
8
+ downloadable=$( curl -sSL ' https ://www.elastic.co /downloads/past-releases ' | sed -rn ' s!.*?/ downloads/past-releases/ [0-9]+-[0-9]+-[0-9]+">Elasticsearch ([0-9]+\.[0-9]+\.[0-9]+)<.*!\1!gp' )
9
9
10
10
for version in " ${versions[@]} " ; do
11
11
recent=$( echo " $downloadable " | grep -m 1 " $version " )
12
- sed -ri -e ' s/^(ENV ELASTICSEARCH_VERSION) .*/\1 ' " $recent " ' /' " $version /Dockerfile"
12
+ sed ' s/%%VERSION%%/' " $recent " ' /' < Dockerfile.template > " $version /Dockerfile"
13
+ cp -p docker-entrypoint.sh $version
13
14
done
You can’t perform that action at this time.
0 commit comments