From 52ce54ac2e62f0bb21355e3d6da080fc3fcaad03 Mon Sep 17 00:00:00 2001 From: ishikawa Date: Fri, 31 May 2024 10:56:08 +0900 Subject: [PATCH] Add RedMica v3.0.0 --- .github/workflows/build_test.yml | 2 +- .github/workflows/publish_docker_image.yml | 6 +-- {2.4.2 => 3.0.0}/Dockerfile | 45 +++++++++++++--- {2.4.2 => 3.0.0}/alpine/Dockerfile | 4 +- {2.4.2 => 3.0.0}/alpine/docker-entrypoint.sh | 0 {2.4.2 => 3.0.0}/docker-entrypoint.sh | 0 Dockerfile-alpine.template | 2 +- Dockerfile-debian.template | 43 ++++++++++++--- description.md | 56 ++------------------ 9 files changed, 83 insertions(+), 75 deletions(-) rename {2.4.2 => 3.0.0}/Dockerfile (73%) rename {2.4.2 => 3.0.0}/alpine/Dockerfile (98%) rename {2.4.2 => 3.0.0}/alpine/docker-entrypoint.sh (100%) rename {2.4.2 => 3.0.0}/docker-entrypoint.sh (100%) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 9c34699..e88e0f8 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -10,7 +10,7 @@ jobs: timeout-minutes: 10 strategy: matrix: - target: ['2.4.2', '2.4.2/alpine'] + target: ['3.0.0', '3.0.0/alpine'] steps: - name: Checkout uses: actions/checkout@v3 diff --git a/.github/workflows/publish_docker_image.yml b/.github/workflows/publish_docker_image.yml index 28f2059..9d97d5b 100644 --- a/.github/workflows/publish_docker_image.yml +++ b/.github/workflows/publish_docker_image.yml @@ -11,10 +11,10 @@ jobs: fail-fast: false matrix: version: - [2.4.2] + [3.0.0] include: - - version: 2.4.2 - other_tag: '2.4' + - version: 3.0.0 + other_tag: '3.0' latest: true # - version: 2.0.0 # other_tag: '2.0' diff --git a/2.4.2/Dockerfile b/3.0.0/Dockerfile similarity index 73% rename from 2.4.2/Dockerfile rename to 3.0.0/Dockerfile index 0fe0430..8ed5688 100644 --- a/2.4.2/Dockerfile +++ b/3.0.0/Dockerfile @@ -7,7 +7,6 @@ RUN groupadd -r -g 999 redmine && useradd -r -g redmine -u 999 redmine RUN set -eux; \ apt-get update; \ apt-get install -y --no-install-recommends \ - findutils \ ca-certificates \ curl \ wget \ @@ -19,21 +18,46 @@ RUN set -eux; \ subversion \ \ # we need "gsfonts" for generating PNGs of Gantt charts -# and "ghostscript" for creating PDF thumbnails (in Redmine 4.1+) +# and "ghostscript" for creating PDF thumbnails (in 4.1+) ghostscript \ gsfonts \ imagemagick \ -# grab gosu for easy step-down from root - gosu \ # grab tini for signal processing and zombie killing tini \ -# https://github.com/docker-library/ruby/issues/344 - shared-mime-info \ ; \ # allow imagemagick to use ghostscript for PDF -> PNG thumbnail conversion (4.1+) sed -ri 's/(rights)="none" (pattern="PDF")/\1="read" \2/' /etc/ImageMagick-6/policy.xml; \ rm -rf /var/lib/apt/lists/* +# grab gosu for easy step-down from root +ENV GOSU_VERSION 1.17 +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + gnupg \ + ; \ + rm -rf /var/lib/apt/lists/*; \ + \ + dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ + wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ + wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ + gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ + \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark > /dev/null; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + \ +# smoke test + chmod +x /usr/local/bin/gosu; \ + gosu --version; \ + gosu nobody true + ENV RAILS_ENV production WORKDIR /usr/src/redmine @@ -46,7 +70,7 @@ RUN set -eux; \ chown redmine:redmine "$HOME"; \ chmod 1777 "$HOME" -ENV REDMICA_VERSION 2.4.2 +ENV REDMICA_VERSION 3.0.0 RUN set -eux; \ wget -O redmine.tar.gz "https://github.com/redmica/redmica/archive/v${REDMICA_VERSION}.tar.gz"; \ @@ -70,8 +94,11 @@ RUN set -eux; \ gcc \ libpq-dev \ libsqlite3-dev \ + libxml2-dev \ + libxslt-dev \ make \ patch \ + pkgconf \ xz-utils \ ; \ rm -rf /var/lib/apt/lists/*; \ @@ -88,6 +115,8 @@ RUN set -eux; \ echo "$adapter:" >> ./config/database.yml; \ echo " adapter: $adapter" >> ./config/database.yml; \ done; \ +# nokogiri's vendored libxml2 + libxslt do not build on mips64le, so use the apt packages when building + gosu redmine bundle config build.nokogiri --use-system-libraries; \ gosu redmine bundle install --jobs "$(nproc)"; \ rm ./config/database.yml; \ # fix permissions for running as an arbitrary user @@ -98,7 +127,7 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ | xargs -r dpkg-query --search \ | cut -d: -f1 \ diff --git a/2.4.2/alpine/Dockerfile b/3.0.0/alpine/Dockerfile similarity index 98% rename from 2.4.2/alpine/Dockerfile rename to 3.0.0/alpine/Dockerfile index 6b5799f..cdd8657 100644 --- a/2.4.2/alpine/Dockerfile +++ b/3.0.0/alpine/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:3.2-alpine3.18 +FROM ruby:3.2-alpine3.20 # explicitly set uid/gid to guarantee that it won't change in the future # the values 999:999 are identical to the current user/group id assigned @@ -40,7 +40,7 @@ RUN set -eux; \ chown redmine:redmine "$HOME"; \ chmod 1777 "$HOME" -ENV REDMICA_VERSION 2.4.2 +ENV REDMICA_VERSION 3.0.0 RUN set -eux; \ wget -O redmine.tar.gz "https://github.com/redmica/redmica/archive/v${REDMICA_VERSION}.tar.gz"; \ diff --git a/2.4.2/alpine/docker-entrypoint.sh b/3.0.0/alpine/docker-entrypoint.sh similarity index 100% rename from 2.4.2/alpine/docker-entrypoint.sh rename to 3.0.0/alpine/docker-entrypoint.sh diff --git a/2.4.2/docker-entrypoint.sh b/3.0.0/docker-entrypoint.sh similarity index 100% rename from 2.4.2/docker-entrypoint.sh rename to 3.0.0/docker-entrypoint.sh diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template index d63be63..a1f9dc8 100644 --- a/Dockerfile-alpine.template +++ b/Dockerfile-alpine.template @@ -1,4 +1,4 @@ -FROM ruby:%%RUBY_VERSION%%-alpine3.18 +FROM ruby:%%RUBY_VERSION%%-alpine3.20 # explicitly set uid/gid to guarantee that it won't change in the future # the values 999:999 are identical to the current user/group id assigned diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template index c86f043..01f26fe 100644 --- a/Dockerfile-debian.template +++ b/Dockerfile-debian.template @@ -7,7 +7,6 @@ RUN groupadd -r -g 999 redmine && useradd -r -g redmine -u 999 redmine RUN set -eux; \ apt-get update; \ apt-get install -y --no-install-recommends \ - findutils \ ca-certificates \ curl \ wget \ @@ -19,21 +18,46 @@ RUN set -eux; \ subversion \ \ # we need "gsfonts" for generating PNGs of Gantt charts -# and "ghostscript" for creating PDF thumbnails (in Redmine 4.1+) +# and "ghostscript" for creating PDF thumbnails (in 4.1+) ghostscript \ gsfonts \ imagemagick \ -# grab gosu for easy step-down from root - gosu \ # grab tini for signal processing and zombie killing tini \ -# https://github.com/docker-library/ruby/issues/344 - shared-mime-info \ ; \ # allow imagemagick to use ghostscript for PDF -> PNG thumbnail conversion (4.1+) sed -ri 's/(rights)="none" (pattern="PDF")/\1="read" \2/' /etc/ImageMagick-6/policy.xml; \ rm -rf /var/lib/apt/lists/* +# grab gosu for easy step-down from root +ENV GOSU_VERSION 1.17 +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + gnupg \ + ; \ + rm -rf /var/lib/apt/lists/*; \ + \ + dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ + wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ + wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ + gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ + \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark > /dev/null; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + \ +# smoke test + chmod +x /usr/local/bin/gosu; \ + gosu --version; \ + gosu nobody true + ENV RAILS_ENV production WORKDIR /usr/src/redmine @@ -70,8 +94,11 @@ RUN set -eux; \ gcc \ libpq-dev \ libsqlite3-dev \ + libxml2-dev \ + libxslt-dev \ make \ patch \ + pkgconf \ xz-utils \ ; \ rm -rf /var/lib/apt/lists/*; \ @@ -88,6 +115,8 @@ RUN set -eux; \ echo "$adapter:" >> ./config/database.yml; \ echo " adapter: $adapter" >> ./config/database.yml; \ done; \ +# nokogiri's vendored libxml2 + libxslt do not build on mips64le, so use the apt packages when building + gosu redmine bundle config build.nokogiri --use-system-libraries; \ gosu redmine bundle install --jobs "$(nproc)"; \ rm ./config/database.yml; \ # fix permissions for running as an arbitrary user @@ -98,7 +127,7 @@ RUN set -eux; \ apt-mark auto '.*' > /dev/null; \ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \ | sort -u \ | xargs -r dpkg-query --search \ | cut -d: -f1 \ diff --git a/description.md b/description.md index eff7fd5..68e09c8 100644 --- a/description.md +++ b/description.md @@ -1,60 +1,10 @@ ![RedMica logo](https://github.com/redmica/redmica-logo/raw/master/horizontal/redmica-logo-horizontal-small.png "RedMica logo") -# Supported tags +# latest -- [2.4.1](https://github.com/redmica/redmica_docker/blob/master/2.4.1/Dockerfile), [2.4](https://github.com/redmica/redmica_docker/blob/master/2.4.1/Dockerfile), [latest](https://github.com/redmica/redmica_docker/blob/master/2.4.1/Dockerfile) -- [2.4.1-alpine](https://github.com/redmica/redmica_docker/blob/master/2.4.1/alpine/Dockerfile) - -- [2.4.0](https://github.com/redmica/redmica_docker/blob/master/2.4.0/Dockerfile) -- [2.4.0-alpine](https://github.com/redmica/redmica_docker/blob/master/2.4.0/alpine/Dockerfile) - ----- - -- [2.3.2](https://github.com/redmica/redmica_docker/blob/master/2.3.2/Dockerfile), [2.3](https://github.com/redmica/redmica_docker/blob/master/2.3.2/Dockerfile) -- [2.3.2-alpine](https://github.com/redmica/redmica_docker/blob/master/2.3.2/alpine/Dockerfile) - -- [2.3.1](https://github.com/redmica/redmica_docker/blob/master/2.3.1/Dockerfile) -- [2.3.1-alpine](https://github.com/redmica/redmica_docker/blob/master/2.3.1/alpine/Dockerfile) - -- [2.3.0](https://github.com/redmica/redmica_docker/blob/master/2.3.0/Dockerfile) -- [2.3.0-alpine](https://github.com/redmica/redmica_docker/blob/master/2.3.0/alpine/Dockerfile) - ----- - -- [2.2.3](https://github.com/redmica/redmica_docker/blob/master/2.2.3/Dockerfile), [2.2](https://github.com/redmica/redmica_docker/blob/master/2.2.3/Dockerfile) -- [2.2.3-alpine](https://github.com/redmica/redmica_docker/blob/master/2.2.3/alpine/Dockerfile) - ----- - -- [2.2.2](https://github.com/redmica/redmica_docker/blob/master/2.2.2/Dockerfile) -- [2.2.2-alpine](https://github.com/redmica/redmica_docker/blob/master/2.2.2/alpine/Dockerfile) - ----- - -- [2.2.1](https://github.com/redmica/redmica_docker/blob/master/2.2.1/Dockerfile) -- [2.2.1-alpine](https://github.com/redmica/redmica_docker/blob/master/2.2.1/alpine/Dockerfile) - ----- - -- [2.2.0](https://github.com/redmica/redmica_docker/blob/master/2.2.0/Dockerfile) -- [2.2.0-alpine](https://github.com/redmica/redmica_docker/blob/master/2.2.0/alpine/Dockerfile) - ----- - -- [2.1.1](https://github.com/redmica/redmica_docker/blob/master/2.1.1/Dockerfile), [2.1](https://github.com/redmica/redmica_docker/blob/master/2.1.1/Dockerfile) -- [2.1.1-alpine](https://github.com/redmica/redmica_docker/blob/master/2.1.1/alpine/Dockerfile) - ---- - -- [2.1.0](https://github.com/redmica/redmica_docker/blob/master/2.1.0/Dockerfile) -- [2.1.0-alpine](https://github.com/redmica/redmica_docker/blob/master/2.1.0/alpine/Dockerfile) - ---- - -- [2.0.0](https://github.com/redmica/redmica_docker/blob/master/2.0.0/Dockerfile), [2.0](https://github.com/redmica/redmica_docker/blob/master/2.0.0/Dockerfile) -- [2.0.0-passenger](https://github.com/redmica/redmica_docker/blob/master/2.0.0/passenger/Dockerfile) -- [2.0.0-alpine](https://github.com/redmica/redmica_docker/blob/master/2.0.0/alpine/Dockerfile) +- [3.0.0](https://github.com/redmica/redmica_docker/blob/master/3.0.0/Dockerfile), [3.0](https://github.com/redmica/redmica_docker/blob/master/3.0.0/Dockerfile), [latest](https://github.com/redmica/redmica_docker/blob/master/3.0.0/Dockerfile) +- [3.0.0-alpine](https://github.com/redmica/redmica_docker/blob/master/3.0.0/alpine/Dockerfile) # How to use this image