From e8adda11eee9478f8d93318de7deab5174417bcf Mon Sep 17 00:00:00 2001 From: nadeem Date: Tue, 19 Jul 2022 14:56:32 +0100 Subject: [PATCH] Update to use new Minideb Ruby base image https://trello.com/c/dwXqpVAi/968-base-and-builder-images --- .ruby-version | 2 +- Dockerfile | 30 +++++++++--------------------- Gemfile | 2 -- Gemfile.lock | 3 --- 4 files changed, 10 insertions(+), 27 deletions(-) diff --git a/.ruby-version b/.ruby-version index 49cdd668e..1effb0034 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.6 +2.7 diff --git a/Dockerfile b/Dockerfile index 401af4012..e5d2374ee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,9 @@ -ARG base_image=ruby:2.7.6-slim-buster +ARG base_image=ghcr.io/alphagov/govuk-ruby-base:2.7 +ARG builder_image=ghcr.io/alphagov/govuk-ruby-builder:2.7 -FROM $base_image AS builder +FROM $builder_image AS builder -ENV RAILS_ENV=production GOVUK_APP_NAME=static - -RUN apt-get update -qq && \ - apt-get upgrade -y && \ - apt-get install -y build-essential nodejs && \ - apt-get clean +ENV GOVUK_APP_NAME=static RUN mkdir /app @@ -15,30 +11,22 @@ WORKDIR /app COPY Gemfile* .ruby-version /app/ -RUN bundle config set deployment 'true' && \ - bundle config set without 'development test' && \ - bundle install --jobs 4 --retry=2 +RUN bundle install COPY . /app -RUN GOVUK_WEBSITE_ROOT=https://www.gov.uk GOVUK_APP_DOMAIN=www.gov.uk bundle exec rails assets:precompile - -FROM $base_image +RUN bundle exec rails assets:precompile && rm -fr /app/log -ENV GOVUK_PROMETHEUS_EXPORTER=true RAILS_ENV=production GOVUK_APP_NAME=static -RUN apt-get update -qy && \ - apt-get upgrade -y && \ - apt-get install -y nodejs +FROM $base_image -RUN groupadd -g 1001 appuser && \ - useradd appuser -u 1001 -g 1001 --home /app +ENV GOVUK_APP_NAME=static COPY --from=builder /usr/local/bundle/ /usr/local/bundle/ COPY --from=builder /app /app RUN mkdir -p /app/public/templates && chown -R 1001:1001 /app/public/templates -USER appuser +USER app WORKDIR /app CMD bundle exec puma diff --git a/Gemfile b/Gemfile index 953a941e6..793242afd 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,5 @@ source "https://rubygems.org" -ruby File.read(".ruby-version").chomp - gem "rails", "6.1.6.1" gem "actionpack-page_caching" diff --git a/Gemfile.lock b/Gemfile.lock index 83bd2bfad..76a5a8454 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -367,8 +367,5 @@ DEPENDENCIES uglifier webmock -RUBY VERSION - ruby 2.7.6p219 - BUNDLED WITH 2.1.4