Adapt Dockerfile.productiono to openSUSE Leap 15.6

- No need to manually install bundler anymore
- bundle to vendor/bundle
- build nokogiri against system libraries
- expose the port foreman is using
- serve static files
This commit is contained in:
Henne Vogelsang 2025-09-04 17:10:33 +02:00
parent eca537daf7
commit 93662dc489
No known key found for this signature in database
GPG key ID: 97DDB66BDAF8D4D6
3 changed files with 26 additions and 16 deletions

View file

@ -1,20 +1,28 @@
FROM registry.opensuse.org/opensuse/infrastructure/dale/containers/osem/base:latest
EXPOSE 5000
ENV RAILS_ENV=production
ENV RAILS_SERVE_STATIC_FILES=true
# 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
# Install foreman
RUN gem install foreman
USER osem
WORKDIR /osem/
RUN rm -rf /osem/public/system/sponsors; mkdir -p /osem/public/system/sponsors; \
rm -rf /osem/public/assets; mkdir -p /osem/public/assets; \
rm -rf /osem/log; mkdir -p /osem/public/assets
# Install our bundle
RUN bundle config set --local without 'test development'
RUN bundle install --jobs=3 --retry=3
RUN bundle config set --local without 'test development'; \
bundle config set --local path 'vendor/bundle'; \
bundle config build.nokogiri --use-system-libraries; \
bundle install --jobs=4 --retry=3
# Generate assets
RUN bundle exec rake assets:precompile