Skip to content

Commit e0d91f1

Browse files
committed
Add 1.7 and 2.4 alpine variants
1 parent 4e4394f commit e0d91f1

File tree

11 files changed

+304
-25
lines changed

11 files changed

+304
-25
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ env:
55
- VERSION=5 VARIANT=
66
- VERSION=5 VARIANT=alpine
77
- VERSION=2.4 VARIANT=
8+
- VERSION=2.4 VARIANT=alpine
89
- VERSION=1.7 VARIANT=
10+
- VERSION=1.7 VARIANT=alpine
911

1012
install:
1113
- git clone https://github.com/docker-library/official-images.git ~/official-images

1.7/alpine/Dockerfile

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
FROM openjdk:8-jre-alpine
2+
3+
# ensure elasticsearch user exists
4+
RUN addgroup -S elasticsearch && adduser -S -G elasticsearch elasticsearch
5+
6+
# grab su-exec for easy step-down from root
7+
# and bash for "bin/elasticsearch" among others
8+
RUN apk add --no-cache 'su-exec>=0.2' bash
9+
10+
# https://artifacts.elastic.co/GPG-KEY-elasticsearch
11+
ENV GPG_KEY 46095ACC8548582C1A2699A9D27D666CD88E42B4
12+
13+
WORKDIR /usr/share/elasticsearch
14+
ENV PATH /usr/share/elasticsearch/bin:$PATH
15+
16+
ENV ELASTICSEARCH_VERSION 1.7.6
17+
ENV ELASTICSEARCH_TARBALL="https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.6.tar.gz" \
18+
ELASTICSEARCH_TARBALL_ASC="" \
19+
ELASTICSEARCH_TARBALL_SHA1="0b6ec9fe34b29e6adc4d8481630bf1f69cb04aa9"
20+
21+
RUN set -ex; \
22+
\
23+
apk add --no-cache --virtual .fetch-deps \
24+
ca-certificates \
25+
gnupg \
26+
openssl \
27+
tar \
28+
; \
29+
\
30+
wget -O elasticsearch.tar.gz "$ELASTICSEARCH_TARBALL"; \
31+
\
32+
if [ "$ELASTICSEARCH_TARBALL_SHA1" ]; then \
33+
echo "$ELASTICSEARCH_TARBALL_SHA1 *elasticsearch.tar.gz" | sha1sum -c -; \
34+
fi; \
35+
\
36+
if [ "$ELASTICSEARCH_TARBALL_ASC" ]; then \
37+
wget -O elasticsearch.tar.gz.asc "$ELASTICSEARCH_TARBALL_ASC"; \
38+
export GNUPGHOME="$(mktemp -d)"; \
39+
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY"; \
40+
gpg --batch --verify elasticsearch.tar.gz.asc elasticsearch.tar.gz; \
41+
rm -r "$GNUPGHOME" elasticsearch.tar.gz.asc; \
42+
fi; \
43+
\
44+
tar -xf elasticsearch.tar.gz --strip-components=1; \
45+
rm elasticsearch.tar.gz; \
46+
\
47+
apk del .fetch-deps; \
48+
\
49+
mkdir -p ./plugins; \
50+
for path in \
51+
./data \
52+
./logs \
53+
./config \
54+
./config/scripts \
55+
; do \
56+
mkdir -p "$path"; \
57+
chown -R elasticsearch:elasticsearch "$path"; \
58+
done; \
59+
\
60+
if [ "${ELASTICSEARCH_VERSION%%.*}" -gt 1 ]; then \
61+
elasticsearch --version; \
62+
else \
63+
# elasticsearch 1.x doesn't support --version
64+
# but in 5.x, "-v" is verbose (and "-V" is --version)
65+
elasticsearch -v; \
66+
fi
67+
68+
COPY config ./config
69+
70+
VOLUME /usr/share/elasticsearch/data
71+
72+
COPY docker-entrypoint.sh /
73+
74+
EXPOSE 9200 9300
75+
ENTRYPOINT ["/docker-entrypoint.sh"]
76+
CMD ["elasticsearch"]

1.7/alpine/config/logging.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# you can override this using by setting a system property, for example -Des.logger.level=DEBUG
2+
es.logger.level: INFO
3+
rootLogger: ${es.logger.level}, console
4+
logger:
5+
# log action execution errors for easier debugging
6+
action: DEBUG
7+
# reduce the logging for aws, too much is logged under the default INFO
8+
com.amazonaws: WARN
9+
10+
appender:
11+
console:
12+
type: console
13+
layout:
14+
type: consolePattern
15+
conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"

1.7/alpine/docker-entrypoint.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
# allow the container to be started with `--user`
12+
if [ "$1" = 'elasticsearch' -a "$(id -u)" = '0' ]; then
13+
# Change the ownership of /usr/share/elasticsearch/data to elasticsearch
14+
chown -R elasticsearch:elasticsearch /usr/share/elasticsearch/data
15+
16+
set -- su-exec elasticsearch "$@"
17+
#exec su-exec elasticsearch "$BASH_SOURCE" "$@"
18+
fi
19+
20+
# As argument is not related to elasticsearch,
21+
# then assume that user wants to run his own process,
22+
# for example a `bash` shell to explore this image
23+
exec "$@"

2.4/alpine/Dockerfile

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
FROM openjdk:8-jre-alpine
2+
3+
# ensure elasticsearch user exists
4+
RUN addgroup -S elasticsearch && adduser -S -G elasticsearch elasticsearch
5+
6+
# grab su-exec for easy step-down from root
7+
# and bash for "bin/elasticsearch" among others
8+
RUN apk add --no-cache 'su-exec>=0.2' bash
9+
10+
# https://artifacts.elastic.co/GPG-KEY-elasticsearch
11+
ENV GPG_KEY 46095ACC8548582C1A2699A9D27D666CD88E42B4
12+
13+
WORKDIR /usr/share/elasticsearch
14+
ENV PATH /usr/share/elasticsearch/bin:$PATH
15+
16+
ENV ELASTICSEARCH_VERSION 2.4.2
17+
ENV ELASTICSEARCH_TARBALL="https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-2.4.2.tar.gz" \
18+
ELASTICSEARCH_TARBALL_ASC="https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-2.4.2.tar.gz.asc" \
19+
ELASTICSEARCH_TARBALL_SHA1="25effa2daacf5ba65151103dd47339fd88826756"
20+
21+
RUN set -ex; \
22+
\
23+
apk add --no-cache --virtual .fetch-deps \
24+
ca-certificates \
25+
gnupg \
26+
openssl \
27+
tar \
28+
; \
29+
\
30+
wget -O elasticsearch.tar.gz "$ELASTICSEARCH_TARBALL"; \
31+
\
32+
if [ "$ELASTICSEARCH_TARBALL_SHA1" ]; then \
33+
echo "$ELASTICSEARCH_TARBALL_SHA1 *elasticsearch.tar.gz" | sha1sum -c -; \
34+
fi; \
35+
\
36+
if [ "$ELASTICSEARCH_TARBALL_ASC" ]; then \
37+
wget -O elasticsearch.tar.gz.asc "$ELASTICSEARCH_TARBALL_ASC"; \
38+
export GNUPGHOME="$(mktemp -d)"; \
39+
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY"; \
40+
gpg --batch --verify elasticsearch.tar.gz.asc elasticsearch.tar.gz; \
41+
rm -r "$GNUPGHOME" elasticsearch.tar.gz.asc; \
42+
fi; \
43+
\
44+
tar -xf elasticsearch.tar.gz --strip-components=1; \
45+
rm elasticsearch.tar.gz; \
46+
\
47+
apk del .fetch-deps; \
48+
\
49+
mkdir -p ./plugins; \
50+
for path in \
51+
./data \
52+
./logs \
53+
./config \
54+
./config/scripts \
55+
; do \
56+
mkdir -p "$path"; \
57+
chown -R elasticsearch:elasticsearch "$path"; \
58+
done; \
59+
\
60+
if [ "${ELASTICSEARCH_VERSION%%.*}" -gt 1 ]; then \
61+
elasticsearch --version; \
62+
else \
63+
# elasticsearch 1.x doesn't support --version
64+
# but in 5.x, "-v" is verbose (and "-V" is --version)
65+
elasticsearch -v; \
66+
fi
67+
68+
COPY config ./config
69+
70+
VOLUME /usr/share/elasticsearch/data
71+
72+
COPY docker-entrypoint.sh /
73+
74+
EXPOSE 9200 9300
75+
ENTRYPOINT ["/docker-entrypoint.sh"]
76+
CMD ["elasticsearch"]

2.4/alpine/config/elasticsearch.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
network.host: 0.0.0.0

2.4/alpine/config/logging.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# you can override this using by setting a system property, for example -Des.logger.level=DEBUG
2+
es.logger.level: INFO
3+
rootLogger: ${es.logger.level}, console
4+
logger:
5+
# log action execution errors for easier debugging
6+
action: DEBUG
7+
# reduce the logging for aws, too much is logged under the default INFO
8+
com.amazonaws: WARN
9+
10+
appender:
11+
console:
12+
type: console
13+
layout:
14+
type: consolePattern
15+
conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"

2.4/alpine/docker-entrypoint.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
# allow the container to be started with `--user`
12+
if [ "$1" = 'elasticsearch' -a "$(id -u)" = '0' ]; then
13+
# Change the ownership of /usr/share/elasticsearch/data to elasticsearch
14+
chown -R elasticsearch:elasticsearch /usr/share/elasticsearch/data
15+
16+
set -- su-exec elasticsearch "$@"
17+
#exec su-exec elasticsearch "$BASH_SOURCE" "$@"
18+
fi
19+
20+
# As argument is not related to elasticsearch,
21+
# then assume that user wants to run his own process,
22+
# for example a `bash` shell to explore this image
23+
exec "$@"

5/alpine/Dockerfile

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ RUN apk add --no-cache 'su-exec>=0.2' bash
1010
# https://artifacts.elastic.co/GPG-KEY-elasticsearch
1111
ENV GPG_KEY 46095ACC8548582C1A2699A9D27D666CD88E42B4
1212

13-
ENV ELASTICSEARCH_VERSION 5.1.1
14-
15-
ENV PATH /usr/share/elasticsearch/bin:$PATH
1613
WORKDIR /usr/share/elasticsearch
14+
ENV PATH /usr/share/elasticsearch/bin:$PATH
15+
16+
ENV ELASTICSEARCH_VERSION 5.1.1
17+
ENV ELASTICSEARCH_TARBALL="https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.tar.gz" \
18+
ELASTICSEARCH_TARBALL_ASC="https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.tar.gz.asc" \
19+
ELASTICSEARCH_TARBALL_SHA1="7351cd29ac9c20592d94bde950f513b5c5bb44d3"
1720

1821
RUN set -ex; \
1922
\
@@ -24,19 +27,26 @@ RUN set -ex; \
2427
tar \
2528
; \
2629
\
27-
wget -O elasticsearch.tar.gz "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ELASTICSEARCH_VERSION}.tar.gz"; \
30+
wget -O elasticsearch.tar.gz "$ELASTICSEARCH_TARBALL"; \
31+
\
32+
if [ "$ELASTICSEARCH_TARBALL_SHA1" ]; then \
33+
echo "$ELASTICSEARCH_TARBALL_SHA1 *elasticsearch.tar.gz" | sha1sum -c -; \
34+
fi; \
2835
\
29-
wget -O elasticsearch.tar.gz.asc "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ELASTICSEARCH_VERSION}.tar.gz.asc"; \
30-
export GNUPGHOME="$(mktemp -d)"; \
31-
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY"; \
32-
gpg --batch --verify elasticsearch.tar.gz.asc elasticsearch.tar.gz; \
33-
rm -r "$GNUPGHOME" elasticsearch.tar.gz.asc; \
36+
if [ "$ELASTICSEARCH_TARBALL_ASC" ]; then \
37+
wget -O elasticsearch.tar.gz.asc "$ELASTICSEARCH_TARBALL_ASC"; \
38+
export GNUPGHOME="$(mktemp -d)"; \
39+
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY"; \
40+
gpg --batch --verify elasticsearch.tar.gz.asc elasticsearch.tar.gz; \
41+
rm -r "$GNUPGHOME" elasticsearch.tar.gz.asc; \
42+
fi; \
3443
\
3544
tar -xf elasticsearch.tar.gz --strip-components=1; \
3645
rm elasticsearch.tar.gz; \
3746
\
3847
apk del .fetch-deps; \
3948
\
49+
mkdir -p ./plugins; \
4050
for path in \
4151
./data \
4252
./logs \
@@ -47,7 +57,13 @@ RUN set -ex; \
4757
chown -R elasticsearch:elasticsearch "$path"; \
4858
done; \
4959
\
50-
elasticsearch --version
60+
if [ "${ELASTICSEARCH_VERSION%%.*}" -gt 1 ]; then \
61+
elasticsearch --version; \
62+
else \
63+
# elasticsearch 1.x doesn't support --version
64+
# but in 5.x, "-v" is verbose (and "-V" is --version)
65+
elasticsearch -v; \
66+
fi
5167

5268
COPY config ./config
5369

Dockerfile-alpine.template

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ RUN apk add --no-cache 'su-exec>=0.2' bash
1010
# https://artifacts.elastic.co/GPG-KEY-elasticsearch
1111
ENV GPG_KEY 46095ACC8548582C1A2699A9D27D666CD88E42B4
1212

13-
ENV ELASTICSEARCH_VERSION %%ELASTICSEARCH_VERSION%%
14-
15-
ENV PATH /usr/share/elasticsearch/bin:$PATH
1613
WORKDIR /usr/share/elasticsearch
14+
ENV PATH /usr/share/elasticsearch/bin:$PATH
15+
16+
ENV ELASTICSEARCH_VERSION %%ELASTICSEARCH_VERSION%%
17+
ENV ELASTICSEARCH_TARBALL="%%ELASTICSEARCH_TARBALL%%" \
18+
ELASTICSEARCH_TARBALL_ASC="%%ELASTICSEARCH_TARBALL_ASC%%" \
19+
ELASTICSEARCH_TARBALL_SHA1="%%ELASTICSEARCH_TARBALL_SHA1%%"
1720

1821
RUN set -ex; \
1922
\
@@ -24,19 +27,26 @@ RUN set -ex; \
2427
tar \
2528
; \
2629
\
27-
wget -O elasticsearch.tar.gz "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ELASTICSEARCH_VERSION}.tar.gz"; \
30+
wget -O elasticsearch.tar.gz "$ELASTICSEARCH_TARBALL"; \
31+
\
32+
if [ "$ELASTICSEARCH_TARBALL_SHA1" ]; then \
33+
echo "$ELASTICSEARCH_TARBALL_SHA1 *elasticsearch.tar.gz" | sha1sum -c -; \
34+
fi; \
2835
\
29-
wget -O elasticsearch.tar.gz.asc "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ELASTICSEARCH_VERSION}.tar.gz.asc"; \
30-
export GNUPGHOME="$(mktemp -d)"; \
31-
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY"; \
32-
gpg --batch --verify elasticsearch.tar.gz.asc elasticsearch.tar.gz; \
33-
rm -r "$GNUPGHOME" elasticsearch.tar.gz.asc; \
36+
if [ "$ELASTICSEARCH_TARBALL_ASC" ]; then \
37+
wget -O elasticsearch.tar.gz.asc "$ELASTICSEARCH_TARBALL_ASC"; \
38+
export GNUPGHOME="$(mktemp -d)"; \
39+
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY"; \
40+
gpg --batch --verify elasticsearch.tar.gz.asc elasticsearch.tar.gz; \
41+
rm -r "$GNUPGHOME" elasticsearch.tar.gz.asc; \
42+
fi; \
3443
\
3544
tar -xf elasticsearch.tar.gz --strip-components=1; \
3645
rm elasticsearch.tar.gz; \
3746
\
3847
apk del .fetch-deps; \
3948
\
49+
mkdir -p ./plugins; \
4050
for path in \
4151
./data \
4252
./logs \
@@ -47,7 +57,13 @@ RUN set -ex; \
4757
chown -R elasticsearch:elasticsearch "$path"; \
4858
done; \
4959
\
50-
elasticsearch --version
60+
if [ "${ELASTICSEARCH_VERSION%%.*}" -gt 1 ]; then \
61+
elasticsearch --version; \
62+
else \
63+
# elasticsearch 1.x doesn't support --version
64+
# but in 5.x, "-v" is verbose (and "-V" is --version)
65+
elasticsearch -v; \
66+
fi
5167

5268
COPY config ./config
5369

0 commit comments

Comments
 (0)