Skip to content

Commit f7e705d

Browse files
author
Jim Crowley
authored
Use official checksums to verify Tini (#55491)
Closes #55490. Use the official checksums when downloading `tini` for our Docker images.
1 parent ee88c6e commit f7e705d

File tree

4 files changed

+25
-17
lines changed

4 files changed

+25
-17
lines changed

distribution/docker/build.gradle

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,32 @@ dependencies {
2828
}
2929

3030
ext.expansions = { architecture, oss, local ->
31+
String base_image = null
32+
String tini_arch = null
33+
String classifier = null
3134
switch (architecture) {
3235
case "aarch64":
36+
base_image = "arm64v8/centos:7"
37+
tini_arch = "arm64"
38+
classifier = "linux-aarch64"
39+
break;
3340
case "x64":
41+
base_image = "amd64/centos:7"
42+
tini_arch = "amd64"
43+
classifier = "linux-x86_64"
3444
break;
3545
default:
3646
throw new IllegalArgumentException("unrecongized architecture [" + architecture + "], must be one of (aarch64|x64)")
3747
}
38-
final String classifier = "aarch64".equals(architecture) ? "linux-aarch64" : "linux-x86_64"
3948
final String elasticsearch = oss ? "elasticsearch-oss-${VersionProperties.elasticsearch}-${classifier}.tar.gz" : "elasticsearch-${VersionProperties.elasticsearch}-${classifier}.tar.gz"
4049
return [
41-
'base_image' : "aarch64".equals(architecture) ? "arm64v8/centos:7" : "centos:7",
50+
'base_image' : base_image,
4251
'build_date' : BuildParams.buildDate,
4352
'elasticsearch' : elasticsearch,
4453
'git_revision' : BuildParams.gitRevision,
4554
'license' : oss ? 'Apache-2.0' : 'Elastic-License',
4655
'source_elasticsearch': local ? "COPY $elasticsearch /opt/" : "RUN cd /opt && curl --retry 8 -s -L -O https://artifacts.elastic.co/downloads/elasticsearch/${elasticsearch} && cd -",
47-
'tini_suffix' : "aarch64".equals(architecture) ? "-arm64" : "",
56+
'tini_arch' : tini_arch,
4857
'version' : VersionProperties.elasticsearch
4958
]
5059
}

distribution/docker/src/docker/Dockerfile

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,22 @@
1414
FROM ${base_image} AS builder
1515

1616
RUN for iter in {1..10}; do yum update --setopt=tsflags=nodocs -y && \
17-
yum install --setopt=tsflags=nodocs -y gzip shadow-utils tar && \
17+
yum install --setopt=tsflags=nodocs -y wget gzip shadow-utils tar && \
1818
yum clean all && exit_code=0 && break || exit_code=\$? && echo "yum error: retry \$iter in 10s" && sleep 10; done; \
1919
(exit \$exit_code)
2020

21+
# `tini` is a tiny but valid init for containers. This is used to cleanly
22+
# control how ES and any child processes are shut down.
23+
#
24+
# The tini GitHub page gives instructions for verifying the binary using
25+
# gpg, but the keyservers are slow to return the key and this can fail the
26+
# build. Instead, we check the binary against a checksum that they provide.
27+
RUN wget --no-cookies --quiet https://github.com/krallin/tini/releases/download/v0.19.0/tini-${tini_arch} \
28+
&& wget --no-cookies --quiet https://github.com/krallin/tini/releases/download/v0.19.0/tini-${tini_arch}.sha256sum \
29+
&& sha256sum -c tini-${tini_arch}.sha256sum \
30+
&& mv tini-${tini_arch} /tini \
31+
&& chmod +x /tini
32+
2133
ENV PATH /usr/share/elasticsearch/bin:\$PATH
2234

2335
RUN groupadd -g 1000 elasticsearch && \
@@ -35,17 +47,6 @@ RUN chmod 0775 config config/jvm.options.d data logs
3547
COPY config/elasticsearch.yml config/log4j2.properties config/
3648
RUN chmod 0660 config/elasticsearch.yml config/log4j2.properties
3749

38-
# `tini` is a tiny but valid init for containers. This is used to cleanly
39-
# control how ES and any child processes are shut down.
40-
#
41-
# The tini GitHub page gives instructions for verifying the binary using
42-
# gpg, but the keyservers are slow to return the key and this can fail the
43-
# build. Instead, we check the binary against a checksum that we have
44-
# computed.
45-
ADD https://github.com/krallin/tini/releases/download/v0.18.0/tini${tini_suffix} /tini
46-
COPY config/tini${tini_suffix}.sha512 /tini.sha512
47-
RUN sha512sum -c /tini.sha512 && chmod +x /tini
48-
4950
################################################################################
5051
# Build stage 1 (the actual elasticsearch image):
5152
# Copy elasticsearch from stage 0

distribution/docker/src/docker/config/tini-arm64.sha512

Lines changed: 0 additions & 1 deletion
This file was deleted.

distribution/docker/src/docker/config/tini.sha512

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)