From 3a4a99179943cea4976132932e52f1559f170f31 Mon Sep 17 00:00:00 2001 From: J0WI Date: Tue, 23 Mar 2021 01:07:15 +0100 Subject: [PATCH 1/3] Revert "Refactor Alpine "scanelf" to use similar "ldd" to Debian to avoid new errors in 4.1.2" This reverts commit f35a8c1c9368bf3306b2dc33d7f14531c7f28273. --- 4.0/alpine/Dockerfile | 12 ++++-------- 4.1/alpine/Dockerfile | 12 ++++-------- Dockerfile-alpine.template | 12 ++++-------- 3 files changed, 12 insertions(+), 24 deletions(-) diff --git a/4.0/alpine/Dockerfile b/4.0/alpine/Dockerfile index a0508b7..a194b85 100644 --- a/4.0/alpine/Dockerfile +++ b/4.0/alpine/Dockerfile @@ -88,14 +88,10 @@ RUN set -eux; \ rm /usr/local/bundle/gems/rbpdf-font-1.19.*/lib/fonts/ttf2ufm/ttf2ufm; \ \ runDeps="$( \ - find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ - | sort -u \ - | grep -v '^/usr/local/' \ - | xargs -rn1 basename \ - | grep -v 'ld-musl-' \ - | sed -e 's/^/so:/' \ - | sort -u \ + scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/bundle/gems \ + | tr ',' '\n' \ + | sort -u \ + | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ )"; \ apk add --no-network --virtual .redmine-rundeps $runDeps; \ apk del --no-network .build-deps diff --git a/4.1/alpine/Dockerfile b/4.1/alpine/Dockerfile index abd7f42..a2419ac 100644 --- a/4.1/alpine/Dockerfile +++ b/4.1/alpine/Dockerfile @@ -87,14 +87,10 @@ RUN set -eux; \ rm /usr/local/bundle/gems/rbpdf-font-1.19.*/lib/fonts/ttf2ufm/ttf2ufm; \ \ runDeps="$( \ - find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ - | sort -u \ - | grep -v '^/usr/local/' \ - | xargs -rn1 basename \ - | grep -v 'ld-musl-' \ - | sed -e 's/^/so:/' \ - | sort -u \ + scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/bundle/gems \ + | tr ',' '\n' \ + | sort -u \ + | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ )"; \ apk add --no-network --virtual .redmine-rundeps $runDeps; \ apk del --no-network .build-deps diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template index 97c3306..e32cb92 100644 --- a/Dockerfile-alpine.template +++ b/Dockerfile-alpine.template @@ -89,14 +89,10 @@ RUN set -eux; \ rm /usr/local/bundle/gems/rbpdf-font-1.19.*/lib/fonts/ttf2ufm/ttf2ufm; \ \ runDeps="$( \ - find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ - | sort -u \ - | grep -v '^/usr/local/' \ - | xargs -rn1 basename \ - | grep -v 'ld-musl-' \ - | sed -e 's/^/so:/' \ - | sort -u \ + scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/bundle/gems \ + | tr ',' '\n' \ + | sort -u \ + | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ )"; \ apk add --no-network --virtual .redmine-rundeps $runDeps; \ apk del --no-network .build-deps From 939e5181dad968bdb1d563934a65540a649cf33b Mon Sep 17 00:00:00 2001 From: J0WI Date: Tue, 23 Mar 2021 01:39:34 +0100 Subject: [PATCH 2/3] Avoid glibc dependency --- 4.0/alpine/Dockerfile | 2 ++ 4.1/alpine/Dockerfile | 2 ++ Dockerfile-alpine.template | 2 ++ 3 files changed, 6 insertions(+) diff --git a/4.0/alpine/Dockerfile b/4.0/alpine/Dockerfile index a194b85..63fc0e0 100644 --- a/4.0/alpine/Dockerfile +++ b/4.0/alpine/Dockerfile @@ -53,6 +53,8 @@ RUN set -eux; \ chmod -R ugo=rwX config db sqlite; \ find log tmp -type d -exec chmod 1777 '{}' + +# build for musl-libc, not glibc +ENV BUNDLE_FORCE_RUBY_PLATFORM 1 RUN set -eux; \ \ apk add --no-cache --virtual .build-deps \ diff --git a/4.1/alpine/Dockerfile b/4.1/alpine/Dockerfile index a2419ac..5299395 100644 --- a/4.1/alpine/Dockerfile +++ b/4.1/alpine/Dockerfile @@ -54,6 +54,8 @@ RUN set -eux; \ chmod -R ugo=rwX config db sqlite; \ find log tmp -type d -exec chmod 1777 '{}' + +# build for musl-libc, not glibc +ENV BUNDLE_FORCE_RUBY_PLATFORM 1 RUN set -eux; \ \ apk add --no-cache --virtual .build-deps \ diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template index e32cb92..baa5b32 100644 --- a/Dockerfile-alpine.template +++ b/Dockerfile-alpine.template @@ -54,6 +54,8 @@ RUN set -eux; \ chmod -R ugo=rwX config db sqlite; \ find log tmp -type d -exec chmod 1777 '{}' + +# build for musl-libc, not glibc +ENV BUNDLE_FORCE_RUBY_PLATFORM 1 RUN set -eux; \ \ apk add --no-cache --virtual .build-deps \ From d93440fe33185a141fc6fbee809cd7cd886acf84 Mon Sep 17 00:00:00 2001 From: J0WI Date: Tue, 23 Mar 2021 21:04:23 +0000 Subject: [PATCH 3/3] Update Dockerfile-alpine.template Co-authored-by: Tianon Gravi --- 4.0/alpine/Dockerfile | 2 +- 4.1/alpine/Dockerfile | 2 +- Dockerfile-alpine.template | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/4.0/alpine/Dockerfile b/4.0/alpine/Dockerfile index 63fc0e0..6a727cd 100644 --- a/4.0/alpine/Dockerfile +++ b/4.0/alpine/Dockerfile @@ -53,7 +53,7 @@ RUN set -eux; \ chmod -R ugo=rwX config db sqlite; \ find log tmp -type d -exec chmod 1777 '{}' + -# build for musl-libc, not glibc +# build for musl-libc, not glibc (see https://github.com/sparklemotion/nokogiri/issues/2075, https://github.com/rubygems/rubygems/issues/3174) ENV BUNDLE_FORCE_RUBY_PLATFORM 1 RUN set -eux; \ \ diff --git a/4.1/alpine/Dockerfile b/4.1/alpine/Dockerfile index 5299395..95693bc 100644 --- a/4.1/alpine/Dockerfile +++ b/4.1/alpine/Dockerfile @@ -54,7 +54,7 @@ RUN set -eux; \ chmod -R ugo=rwX config db sqlite; \ find log tmp -type d -exec chmod 1777 '{}' + -# build for musl-libc, not glibc +# build for musl-libc, not glibc (see https://github.com/sparklemotion/nokogiri/issues/2075, https://github.com/rubygems/rubygems/issues/3174) ENV BUNDLE_FORCE_RUBY_PLATFORM 1 RUN set -eux; \ \ diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template index baa5b32..5baf8e6 100644 --- a/Dockerfile-alpine.template +++ b/Dockerfile-alpine.template @@ -54,7 +54,7 @@ RUN set -eux; \ chmod -R ugo=rwX config db sqlite; \ find log tmp -type d -exec chmod 1777 '{}' + -# build for musl-libc, not glibc +# build for musl-libc, not glibc (see https://github.com/sparklemotion/nokogiri/issues/2075, https://github.com/rubygems/rubygems/issues/3174) ENV BUNDLE_FORCE_RUBY_PLATFORM 1 RUN set -eux; \ \