Skip to content
Snippets Groups Projects
Verified Commit 27ab09e3 authored by Felix Eckhofer's avatar Felix Eckhofer :man_dancing:
Browse files

Switch back to -slim image for final stage to decrease image size

This requires us to duplicate environment variables.

The commit also disables --reproducible mode for kaniko – our images are
not reproducible in the first place (because we run apt-update) and
using the option leads to weird dates being shown for the images.

Closes #58
parent 879ed33a
No related branches found
No related tags found
No related merge requests found
Pipeline #38458 passed
......@@ -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:
......
......@@ -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 && \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment