Fixing the Docker build

This commit is contained in:
Victor Romero 2021-10-12 17:37:58 -05:00
parent 3c418572e9
commit c376747b0d
2 changed files with 18 additions and 12 deletions

View file

@ -1,20 +1,24 @@
FROM registry.opensuse.org/opensuse/infrastructure/osem/containers/osem/base FROM registry.opensuse.org/opensuse/infrastructure/dale/containers/osem/base:latest
ARG CONTAINER_USERID
# Install bundler & foreman # Configure our user
RUN gem install bundler:1.17.3 foreman RUN usermod -u $CONTAINER_USERID osem
# We copy the Gemfiles into this intermediate build stage so it's checksum
# changes and all the subsequent stages (a.k.a. the bundle install call below)
# have to be rebuild. Otherwise, after the first build of this image,
# docker would use it's cache for this and the following stages.
COPY Gemfile /osem/
COPY Gemfile.lock /osem/
RUN chown -R osem /osem
# Add our files # Add our files
COPY --chown=1000:1000 . /osem/
USER osem USER osem
WORKDIR /osem/ WORKDIR /osem/
# Install bundler & foreman
RUN sudo gem install bundler:1.17.3 foreman
# Install our bundle # Install our bundle
RUN export NOKOGIRI_USE_SYSTEM_LIBRARIES=1; bundle install --jobs=3 --retry=3 --without test development RUN export NOKOGIRI_USE_SYSTEM_LIBRARIES=1; bundle install --jobs=3 --retry=3
# Generate assets CMD ["foreman", "start"]
RUN export RAILS_ENV=production; bundle exec rake assets:precompile
ENV RAILS_ENV=production
CMD ["foreman", "start"]

View file

@ -11,6 +11,8 @@ services:
production_web: production_web:
build: build:
context: . context: .
args:
CONTAINER_USERID: 1000
dockerfile: Dockerfile.production dockerfile: Dockerfile.production
depends_on: depends_on:
- production_database - production_database