Skip to content

Commit 866914f

Browse files
committed
Add 5.0.0
Given this is a major release, we're finally removing the passenger variant (it hasn't been well supported for quite some time). Also, install `puma` in all versions (required for 5.0+ to have `rails server` do anything).
1 parent 24906a7 commit 866914f

12 files changed

+593
-6
lines changed

4.1/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ RUN set -eux; \
7777
rm -rf /var/lib/apt/lists/*; \
7878
\
7979
gosu redmine bundle config --local without 'development test'; \
80+
# https://github.com/redmine/redmine/commit/23dc108e70a0794f444803ac827a690085dcd557
81+
# https://rubygems.org/gems/puma/versions
82+
puma="$(grep -E "^[[:space:]]*gem [:'\"]puma['\",[:space:]].*\$" Gemfile)"; \
83+
{ echo; echo "$puma"; } | sed -re 's/^[[:space:]]+//' >> Gemfile; \
84+
# ("gem puma" already exists in the Gemfile, but under "group :test" and we want it all the time)
8085
# fill up "database.yml" with bogus entries so the redmine Gemfile will pre-install all database adapter dependencies
8186
# https://github.com/redmine/redmine/blob/e9f9767089a4e3efbd73c35fc55c5c7eb85dd7d3/Gemfile#L50-L79
8287
echo '# the following entries only exist to force `bundle install` to pre-install all database adapter dependencies -- they can be safely removed/ignored' > ./config/database.yml; \

4.1/alpine/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ RUN set -eux; \
7575
; \
7676
\
7777
su-exec redmine bundle config --local without 'development test'; \
78+
# https://github.com/redmine/redmine/commit/23dc108e70a0794f444803ac827a690085dcd557
79+
# https://rubygems.org/gems/puma/versions
80+
puma="$(grep -E "^[[:space:]]*gem [:'\"]puma['\",[:space:]].*\$" Gemfile)"; \
81+
{ echo; echo "$puma"; } | sed -re 's/^[[:space:]]+//' >> Gemfile; \
82+
# ("gem puma" already exists in the Gemfile, but under "group :test" and we want it all the time)
7883
# fill up "database.yml" with bogus entries so the redmine Gemfile will pre-install all database adapter dependencies
7984
# https://github.com/redmine/redmine/blob/e9f9767089a4e3efbd73c35fc55c5c7eb85dd7d3/Gemfile#L50-L79
8085
echo '# the following entries only exist to force `bundle install` to pre-install all database adapter dependencies -- they can be safely removed/ignored' > ./config/database.yml; \

4.2/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ RUN set -eux; \
7777
rm -rf /var/lib/apt/lists/*; \
7878
\
7979
gosu redmine bundle config --local without 'development test'; \
80+
# https://github.com/redmine/redmine/commit/23dc108e70a0794f444803ac827a690085dcd557
81+
# https://rubygems.org/gems/puma/versions
82+
puma="$(grep -E "^[[:space:]]*gem [:'\"]puma['\",[:space:]].*\$" Gemfile)"; \
83+
{ echo; echo "$puma"; } | sed -re 's/^[[:space:]]+//' >> Gemfile; \
84+
# ("gem puma" already exists in the Gemfile, but under "group :test" and we want it all the time)
8085
# fill up "database.yml" with bogus entries so the redmine Gemfile will pre-install all database adapter dependencies
8186
# https://github.com/redmine/redmine/blob/e9f9767089a4e3efbd73c35fc55c5c7eb85dd7d3/Gemfile#L50-L79
8287
echo '# the following entries only exist to force `bundle install` to pre-install all database adapter dependencies -- they can be safely removed/ignored' > ./config/database.yml; \

4.2/alpine/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ RUN set -eux; \
7575
; \
7676
\
7777
su-exec redmine bundle config --local without 'development test'; \
78+
# https://github.com/redmine/redmine/commit/23dc108e70a0794f444803ac827a690085dcd557
79+
# https://rubygems.org/gems/puma/versions
80+
puma="$(grep -E "^[[:space:]]*gem [:'\"]puma['\",[:space:]].*\$" Gemfile)"; \
81+
{ echo; echo "$puma"; } | sed -re 's/^[[:space:]]+//' >> Gemfile; \
82+
# ("gem puma" already exists in the Gemfile, but under "group :test" and we want it all the time)
7883
# fill up "database.yml" with bogus entries so the redmine Gemfile will pre-install all database adapter dependencies
7984
# https://github.com/redmine/redmine/blob/e9f9767089a4e3efbd73c35fc55c5c7eb85dd7d3/Gemfile#L50-L79
8085
echo '# the following entries only exist to force `bundle install` to pre-install all database adapter dependencies -- they can be safely removed/ignored' > ./config/database.yml; \

5.0/Dockerfile

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
FROM ruby:3.1-slim-bullseye
2+
3+
# explicitly set uid/gid to guarantee that it won't change in the future
4+
# the values 999:999 are identical to the current user/group id assigned
5+
RUN groupadd -r -g 999 redmine && useradd -r -g redmine -u 999 redmine
6+
7+
RUN set -eux; \
8+
apt-get update; \
9+
apt-get install -y --no-install-recommends \
10+
ca-certificates \
11+
curl \
12+
wget \
13+
\
14+
bzr \
15+
git \
16+
mercurial \
17+
openssh-client \
18+
subversion \
19+
\
20+
# we need "gsfonts" for generating PNGs of Gantt charts
21+
# and "ghostscript" for creating PDF thumbnails (in 4.1+)
22+
ghostscript \
23+
gsfonts \
24+
imagemagick \
25+
# grab gosu for easy step-down from root
26+
gosu \
27+
# grab tini for signal processing and zombie killing
28+
tini \
29+
; \
30+
# allow imagemagick to use ghostscript for PDF -> PNG thumbnail conversion (4.1+)
31+
sed -ri 's/(rights)="none" (pattern="PDF")/\1="read" \2/' /etc/ImageMagick-6/policy.xml; \
32+
rm -rf /var/lib/apt/lists/*
33+
34+
ENV RAILS_ENV production
35+
WORKDIR /usr/src/redmine
36+
37+
# https://github.com/docker-library/redmine/issues/138#issuecomment-438834176
38+
# (bundler needs this for running as an arbitrary user)
39+
ENV HOME /home/redmine
40+
RUN set -eux; \
41+
[ ! -d "$HOME" ]; \
42+
mkdir -p "$HOME"; \
43+
chown redmine:redmine "$HOME"; \
44+
chmod 1777 "$HOME"
45+
46+
ENV REDMINE_VERSION 5.0.0
47+
ENV REDMINE_DOWNLOAD_URL https://www.redmine.org/releases/redmine-5.0.0.tar.gz
48+
ENV REDMINE_DOWNLOAD_SHA256 7e840dec846646dae52fff5c631b135d1c915d6e03ea6f01ca8f12ad35803bef
49+
50+
RUN set -eux; \
51+
# if we use wget here, we get certificate issues (https://github.com/docker-library/redmine/pull/249#issuecomment-984176479)
52+
curl -fL -o redmine.tar.gz "$REDMINE_DOWNLOAD_URL"; \
53+
echo "$REDMINE_DOWNLOAD_SHA256 *redmine.tar.gz" | sha256sum -c -; \
54+
tar -xf redmine.tar.gz --strip-components=1; \
55+
rm redmine.tar.gz files/delete.me log/delete.me; \
56+
mkdir -p log public/plugin_assets sqlite tmp/pdf tmp/pids; \
57+
chown -R redmine:redmine ./; \
58+
# log to STDOUT (https://github.com/docker-library/redmine/issues/108)
59+
echo 'config.logger = Logger.new(STDOUT)' > config/additional_environment.rb; \
60+
# fix permissions for running as an arbitrary user
61+
chmod -R ugo=rwX config db sqlite; \
62+
find log tmp -type d -exec chmod 1777 '{}' +
63+
64+
RUN set -eux; \
65+
\
66+
savedAptMark="$(apt-mark showmanual)"; \
67+
apt-get update; \
68+
apt-get install -y --no-install-recommends \
69+
default-libmysqlclient-dev \
70+
freetds-dev \
71+
gcc \
72+
libpq-dev \
73+
libsqlite3-dev \
74+
make \
75+
patch \
76+
; \
77+
rm -rf /var/lib/apt/lists/*; \
78+
\
79+
gosu redmine bundle config --local without 'development test'; \
80+
# https://github.com/redmine/redmine/commit/23dc108e70a0794f444803ac827a690085dcd557
81+
# https://rubygems.org/gems/puma/versions
82+
puma="$(grep -E "^[[:space:]]*gem [:'\"]puma['\",[:space:]].*\$" Gemfile)"; \
83+
{ echo; echo "$puma"; } | sed -re 's/^[[:space:]]+//' >> Gemfile; \
84+
# ("gem puma" already exists in the Gemfile, but under "group :test" and we want it all the time)
85+
# fill up "database.yml" with bogus entries so the redmine Gemfile will pre-install all database adapter dependencies
86+
# https://github.com/redmine/redmine/blob/e9f9767089a4e3efbd73c35fc55c5c7eb85dd7d3/Gemfile#L50-L79
87+
echo '# the following entries only exist to force `bundle install` to pre-install all database adapter dependencies -- they can be safely removed/ignored' > ./config/database.yml; \
88+
for adapter in mysql2 postgresql sqlserver sqlite3; do \
89+
echo "$adapter:" >> ./config/database.yml; \
90+
echo " adapter: $adapter" >> ./config/database.yml; \
91+
done; \
92+
gosu redmine bundle install --jobs "$(nproc)"; \
93+
rm ./config/database.yml; \
94+
# fix permissions for running as an arbitrary user
95+
chmod -R ugo=rwX Gemfile.lock "$GEM_HOME"; \
96+
rm -rf ~redmine/.bundle; \
97+
\
98+
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
99+
apt-mark auto '.*' > /dev/null; \
100+
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
101+
find /usr/local -type f -executable -exec ldd '{}' ';' \
102+
| awk '/=>/ { print $(NF-1) }' \
103+
| sort -u \
104+
| grep -v '^/usr/local/' \
105+
| xargs -r dpkg-query --search \
106+
| cut -d: -f1 \
107+
| sort -u \
108+
| xargs -r apt-mark manual \
109+
; \
110+
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
111+
112+
VOLUME /usr/src/redmine/files
113+
114+
COPY docker-entrypoint.sh /
115+
ENTRYPOINT ["/docker-entrypoint.sh"]
116+
117+
EXPOSE 3000
118+
CMD ["rails", "server", "-b", "0.0.0.0"]

5.0/alpine/Dockerfile

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
FROM ruby:3.1-alpine3.15
2+
3+
# explicitly set uid/gid to guarantee that it won't change in the future
4+
# the values 999:999 are identical to the current user/group id assigned
5+
# alpine already has a gid 999, so we'll use the next id
6+
RUN addgroup -S -g 1000 redmine && adduser -S -H -G redmine -u 999 redmine
7+
8+
RUN set -eux; \
9+
apk add --no-cache \
10+
bash \
11+
ca-certificates \
12+
su-exec \
13+
tini \
14+
tzdata \
15+
wget \
16+
\
17+
breezy \
18+
git \
19+
mercurial \
20+
openssh-client \
21+
subversion \
22+
\
23+
# we need "gsfonts" for generating PNGs of Gantt charts
24+
# and "ghostscript" for creating PDF thumbnails (in 4.1+)
25+
ghostscript \
26+
ghostscript-fonts \
27+
imagemagick \
28+
;
29+
30+
ENV RAILS_ENV production
31+
WORKDIR /usr/src/redmine
32+
33+
# https://github.com/docker-library/redmine/issues/138#issuecomment-438834176
34+
# (bundler needs this for running as an arbitrary user)
35+
ENV HOME /home/redmine
36+
RUN set -eux; \
37+
[ ! -d "$HOME" ]; \
38+
mkdir -p "$HOME"; \
39+
chown redmine:redmine "$HOME"; \
40+
chmod 1777 "$HOME"
41+
42+
ENV REDMINE_VERSION 5.0.0
43+
ENV REDMINE_DOWNLOAD_URL https://www.redmine.org/releases/redmine-5.0.0.tar.gz
44+
ENV REDMINE_DOWNLOAD_SHA256 7e840dec846646dae52fff5c631b135d1c915d6e03ea6f01ca8f12ad35803bef
45+
46+
RUN set -eux; \
47+
wget -O redmine.tar.gz "$REDMINE_DOWNLOAD_URL"; \
48+
echo "$REDMINE_DOWNLOAD_SHA256 *redmine.tar.gz" | sha256sum -c -; \
49+
tar -xf redmine.tar.gz --strip-components=1; \
50+
rm redmine.tar.gz files/delete.me log/delete.me; \
51+
mkdir -p log public/plugin_assets sqlite tmp/pdf tmp/pids; \
52+
chown -R redmine:redmine ./; \
53+
# log to STDOUT (https://github.com/docker-library/redmine/issues/108)
54+
echo 'config.logger = Logger.new(STDOUT)' > config/additional_environment.rb; \
55+
# fix permissions for running as an arbitrary user
56+
chmod -R ugo=rwX config db sqlite; \
57+
find log tmp -type d -exec chmod 1777 '{}' +
58+
59+
# build for musl-libc, not glibc (see https://github.com/sparklemotion/nokogiri/issues/2075, https://github.com/rubygems/rubygems/issues/3174)
60+
ENV BUNDLE_FORCE_RUBY_PLATFORM 1
61+
RUN set -eux; \
62+
\
63+
apk add --no-cache --virtual .build-deps \
64+
coreutils \
65+
freetds-dev \
66+
gcc \
67+
make \
68+
mariadb-dev \
69+
musl-dev \
70+
patch \
71+
postgresql-dev \
72+
sqlite-dev \
73+
ttf2ufm \
74+
zlib-dev \
75+
; \
76+
\
77+
su-exec redmine bundle config --local without 'development test'; \
78+
# https://github.com/redmine/redmine/commit/23dc108e70a0794f444803ac827a690085dcd557
79+
# https://rubygems.org/gems/puma/versions
80+
puma="$(grep -E "^[[:space:]]*gem [:'\"]puma['\",[:space:]].*\$" Gemfile)"; \
81+
{ echo; echo "$puma"; } | sed -re 's/^[[:space:]]+//' >> Gemfile; \
82+
# ("gem puma" already exists in the Gemfile, but under "group :test" and we want it all the time)
83+
# fill up "database.yml" with bogus entries so the redmine Gemfile will pre-install all database adapter dependencies
84+
# https://github.com/redmine/redmine/blob/e9f9767089a4e3efbd73c35fc55c5c7eb85dd7d3/Gemfile#L50-L79
85+
echo '# the following entries only exist to force `bundle install` to pre-install all database adapter dependencies -- they can be safely removed/ignored' > ./config/database.yml; \
86+
for adapter in mysql2 postgresql sqlserver sqlite3; do \
87+
echo "$adapter:" >> ./config/database.yml; \
88+
echo " adapter: $adapter" >> ./config/database.yml; \
89+
done; \
90+
su-exec redmine bundle install --jobs "$(nproc)"; \
91+
rm ./config/database.yml; \
92+
# fix permissions for running as an arbitrary user
93+
chmod -R ugo=rwX Gemfile.lock "$GEM_HOME"; \
94+
# this requires coreutils because "chmod +X" in busybox will remove +x on files (and coreutils leaves files alone with +X)
95+
rm -rf ~redmine/.bundle; \
96+
\
97+
# https://github.com/naitoh/rbpdf/issues/31
98+
rm /usr/local/bundle/gems/rbpdf-font-1.19.*/lib/fonts/ttf2ufm/ttf2ufm; \
99+
\
100+
runDeps="$( \
101+
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/bundle/gems \
102+
| tr ',' '\n' \
103+
| sort -u \
104+
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
105+
)"; \
106+
apk add --no-network --virtual .redmine-rundeps $runDeps; \
107+
apk del --no-network .build-deps
108+
109+
VOLUME /usr/src/redmine/files
110+
111+
COPY docker-entrypoint.sh /
112+
ENTRYPOINT ["/docker-entrypoint.sh"]
113+
114+
EXPOSE 3000
115+
CMD ["rails", "server", "-b", "0.0.0.0"]

0 commit comments

Comments
 (0)