Choose architecture when download tini into docker container
Igor Velkov committed
Apr 21, 2020 at 06:11 UTC
d6bee38a56ed5d3d0c0161ad8f9fdee31628fbf6
1 file changed
+8
-3
Dockerfile
+8
-3
@@ -30,14 +30,19 @@ RUN cd $SRC_DIR \
30
# and tini, a very minimal init daemon for containers
31
ENV SUEXEC_VERSION v0.2
32
ENV TINI_VERSION v0.18.0
33
-RUN set -x \
34
- && cd /tmp \
33
+RUN set -eux; \
34
+ dpkgArch="$(dpkg --print-architecture)"; \
35
+ case "${dpkgArch##*-}" in \
36
+ "amd64" | "armhf" | "arm64") tiniArch="tini-$dpkgArch" ;;\
37
+ *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
38
+ esac; \
39
+ cd /tmp \
40
&& git clone https://github.com/ncopa/su-exec.git \
41
&& cd su-exec \
42
&& git checkout -q $SUEXEC_VERSION \
43
&& make \
44
&& cd /tmp \
40
- && wget -q -O tini https://github.com/krallin/tini/releases/download/$TINI_VERSION/tini \
45
+ && wget -q -O tini https://github.com/krallin/tini/releases/download/$TINI_VERSION/$tiniArch \
46
&& chmod +x tini
47
48
# Now comes the actual target image, which aims to be as small as possible.