Skip to content

Commit

Permalink
Merge pull request #116 from infosiftr/gpg
Browse files Browse the repository at this point in the history
Fix the build by explicitly using jessie (and better install/uninstall of dependencies)
  • Loading branch information
yosifkit authored May 24, 2018
2 parents 358b045 + cf4acba commit 18d9c37
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 51 deletions.
45 changes: 28 additions & 17 deletions 3.3/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:2.3-slim
FROM ruby:2.3-slim-jessie

# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -r redmine && useradd -r -g redmine redmine
Expand Down Expand Up @@ -33,11 +33,6 @@ RUN set -x \
&& tini -h

RUN apt-get update && apt-get install -y --no-install-recommends \
imagemagick \
libmysqlclient18 \
libpq5 \
libsqlite3-0 \
\
bzr \
git \
mercurial \
Expand All @@ -58,7 +53,12 @@ RUN wget -O redmine.tar.gz "https://www.redmine.org/releases/redmine-${REDMINE_V
&& mkdir -p tmp/pdf public/plugin_assets \
&& chown -R redmine:redmine ./

RUN buildDeps=' \
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends \
freetds-dev \
gcc \
libmagickcore-dev \
libmagickwand-dev \
Expand All @@ -67,20 +67,31 @@ RUN buildDeps=' \
libsqlite3-dev \
make \
patch \
' \
&& set -ex \
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& bundle install --without development test \
&& for adapter in mysql2 postgresql sqlserver sqlite3; do \
; \
rm -rf /var/lib/apt/lists/*; \
\
bundle install --without development test; \
for adapter in mysql2 postgresql sqlserver sqlite3; do \
echo "$RAILS_ENV:" > ./config/database.yml; \
echo " adapter: $adapter" >> ./config/database.yml; \
bundle install --without development test; \
cp Gemfile.lock "Gemfile.lock.${adapter}"; \
done \
&& rm ./config/database.yml \
&& apt-get purge -y --auto-remove $buildDeps

done; \
rm ./config/database.yml; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
find /usr/local -type f -executable -exec ldd '{}' ';' \
| awk '/=>/ { print $(NF-1) }' \
| sort -u \
| grep -v '^/usr/local/' \
| xargs -r dpkg-query --search \
| cut -d: -f1 \
| sort -u \
| xargs -r apt-mark manual \
; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false

VOLUME /usr/src/redmine/files

Expand Down
45 changes: 28 additions & 17 deletions 3.4/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:2.4-slim
FROM ruby:2.4-slim-jessie

# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -r redmine && useradd -r -g redmine redmine
Expand Down Expand Up @@ -33,11 +33,6 @@ RUN set -x \
&& tini -h

RUN apt-get update && apt-get install -y --no-install-recommends \
imagemagick \
libmysqlclient18 \
libpq5 \
libsqlite3-0 \
\
bzr \
git \
mercurial \
Expand All @@ -58,7 +53,12 @@ RUN wget -O redmine.tar.gz "https://www.redmine.org/releases/redmine-${REDMINE_V
&& mkdir -p tmp/pdf public/plugin_assets \
&& chown -R redmine:redmine ./

RUN buildDeps=' \
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends \
freetds-dev \
gcc \
libmagickcore-dev \
libmagickwand-dev \
Expand All @@ -67,20 +67,31 @@ RUN buildDeps=' \
libsqlite3-dev \
make \
patch \
' \
&& set -ex \
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& bundle install --without development test \
&& for adapter in mysql2 postgresql sqlserver sqlite3; do \
; \
rm -rf /var/lib/apt/lists/*; \
\
bundle install --without development test; \
for adapter in mysql2 postgresql sqlserver sqlite3; do \
echo "$RAILS_ENV:" > ./config/database.yml; \
echo " adapter: $adapter" >> ./config/database.yml; \
bundle install --without development test; \
cp Gemfile.lock "Gemfile.lock.${adapter}"; \
done \
&& rm ./config/database.yml \
&& apt-get purge -y --auto-remove $buildDeps

done; \
rm ./config/database.yml; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
find /usr/local -type f -executable -exec ldd '{}' ';' \
| awk '/=>/ { print $(NF-1) }' \
| sort -u \
| grep -v '^/usr/local/' \
| xargs -r dpkg-query --search \
| cut -d: -f1 \
| sort -u \
| xargs -r apt-mark manual \
; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false

VOLUME /usr/src/redmine/files

Expand Down
45 changes: 28 additions & 17 deletions Dockerfile.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:%%RUBY_VERSION%%-slim
FROM ruby:%%RUBY_VERSION%%-slim-jessie

# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -r redmine && useradd -r -g redmine redmine
Expand Down Expand Up @@ -33,11 +33,6 @@ RUN set -x \
&& tini -h

RUN apt-get update && apt-get install -y --no-install-recommends \
imagemagick \
libmysqlclient18 \
libpq5 \
libsqlite3-0 \
\
bzr \
git \
mercurial \
Expand All @@ -58,7 +53,12 @@ RUN wget -O redmine.tar.gz "https://www.redmine.org/releases/redmine-${REDMINE_V
&& mkdir -p tmp/pdf public/plugin_assets \
&& chown -R redmine:redmine ./

RUN buildDeps=' \
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends \
freetds-dev \
gcc \
libmagickcore-dev \
libmagickwand-dev \
Expand All @@ -67,20 +67,31 @@ RUN buildDeps=' \
libsqlite3-dev \
make \
patch \
' \
&& set -ex \
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& bundle install --without development test \
&& for adapter in mysql2 postgresql sqlserver sqlite3; do \
; \
rm -rf /var/lib/apt/lists/*; \
\
bundle install --without development test; \
for adapter in mysql2 postgresql sqlserver sqlite3; do \
echo "$RAILS_ENV:" > ./config/database.yml; \
echo " adapter: $adapter" >> ./config/database.yml; \
bundle install --without development test; \
cp Gemfile.lock "Gemfile.lock.${adapter}"; \
done \
&& rm ./config/database.yml \
&& apt-get purge -y --auto-remove $buildDeps

done; \
rm ./config/database.yml; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
find /usr/local -type f -executable -exec ldd '{}' ';' \
| awk '/=>/ { print $(NF-1) }' \
| sort -u \
| grep -v '^/usr/local/' \
| xargs -r dpkg-query --search \
| cut -d: -f1 \
| sort -u \
| xargs -r apt-mark manual \
; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false

VOLUME /usr/src/redmine/files

Expand Down

0 comments on commit 18d9c37

Please sign in to comment.