diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3d0dcd56a8e2010c6f364a2f5bcb0611adbfaabf..4634060961010d90e3efb555d4ba7552463e7f52 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,7 +24,6 @@ docker-image: --context "${CI_PROJECT_DIR}" --dockerfile "${CI_PROJECT_DIR}/Dockerfile" --destination "${DOCKER_IMAGE_NAME}" - --reproducible rules: - if: $CI_COMMIT_BRANCH exists: diff --git a/Dockerfile b/Dockerfile index c1c0afbe05fd8c12935477d1b37075e76f5a6c65..0272d2c440a3e55981e533f28a8a2e22d62b3c3e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,10 @@ # Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile # renovate: datasource=docker depName=registry.docker.com/library/ruby ARG RUBY_VERSION=3.4.2 -FROM registry.docker.com/library/ruby:$RUBY_VERSION AS base + +# ################################################################### +# Throw-away build stage to reduce size of final image +FROM registry.docker.com/library/ruby:$RUBY_VERSION AS build # Rails app lives here WORKDIR /rails @@ -14,10 +17,6 @@ ENV RAILS_ENV="production" \ BUNDLE_PATH="/usr/local/bundle" \ BUNDLE_WITHOUT="development" - -# Throw-away build stage to reduce size of final image -FROM base AS build - # Install packages needed to build gems RUN apt-get update -qq && \ apt-get install --no-install-recommends -y build-essential git libvips pkg-config @@ -38,8 +37,18 @@ RUN bundle exec bootsnap precompile app/ lib/ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile +# ################################################################### # Final stage for app image -FROM base +FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim + +# Rails app lives here +WORKDIR /rails + +# Set production environment +ENV RAILS_ENV="production" \ + BUNDLE_DEPLOYMENT="1" \ + BUNDLE_PATH="/usr/local/bundle" \ + BUNDLE_WITHOUT="development" # Install packages needed for deployment RUN apt-get update -qq && \