From 6f3111c35d151eef4f06f19ea80b3814a937e9ed Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Fri, 25 Feb 2022 16:25:41 +0100 Subject: [PATCH] Fix docker shell environment Move shared variables (nokogiri/path etc.) into the base image. Fixes #2917 --- Dockerfile | 5 ++--- Dockerfile.production | 14 ++++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 276b87a2..4097d60e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,5 @@ FROM registry.opensuse.org/opensuse/infrastructure/dale/containers/osem/base:latest ARG CONTAINER_USERID -ENV NOKOGIRI_USE_SYSTEM_LIBRARIES=1 # Configure our user RUN usermod -u $CONTAINER_USERID osem @@ -14,8 +13,8 @@ COPY Gemfile.lock /osem/ RUN chown -R osem /osem # Install bundler & foreman -RUN gem.ruby3.1 install bundler -v "$(grep -A 1 "BUNDLED WITH" /osem/Gemfile.lock | tail -n 1)"; \ - gem.ruby3.1 install foreman +RUN gem install bundler -v "$(grep -A 1 "BUNDLED WITH" /osem/Gemfile.lock | tail -n 1)"; \ + gem install foreman # Continue as user USER osem diff --git a/Dockerfile.production b/Dockerfile.production index adb84a19..8192c8f0 100644 --- a/Dockerfile.production +++ b/Dockerfile.production @@ -1,20 +1,22 @@ FROM registry.opensuse.org/opensuse/infrastructure/dale/containers/osem/base:latest -# Install bundler & foreman -RUN gem install bundler:1.17.3 foreman +ENV RAILS_ENV=production # Add our files COPY --chown=1000:1000 . /osem/ +# Install bundler & foreman +RUN gem install bundler -v "$(grep -A 1 "BUNDLED WITH" /osem/Gemfile.lock | tail -n 1)"; \ + gem install foreman + USER osem WORKDIR /osem/ # Install our bundle -RUN export NOKOGIRI_USE_SYSTEM_LIBRARIES=1; bundle install --jobs=3 --retry=3 --without test development +RUN bundle config set --local without 'test development' +RUN bundle install --jobs=3 --retry=3 # Generate assets -RUN export RAILS_ENV=production; bundle exec rake assets:precompile - -ENV RAILS_ENV=production +RUN bundle exec rake assets:precompile CMD ["foreman", "start"]