Skip to content

Commit

Permalink
Update to use new Minideb Ruby base image
Browse files Browse the repository at this point in the history
  • Loading branch information
nsabri1 committed Jul 21, 2022
1 parent cbb4858 commit e8adda1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.6
2.7
30 changes: 9 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,44 +1,32 @@
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

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
2 changes: 0 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
source "https://rubygems.org"

ruby File.read(".ruby-version").chomp

gem "rails", "6.1.6.1"

gem "actionpack-page_caching"
Expand Down
3 changes: 0 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,5 @@ DEPENDENCIES
uglifier
webmock

RUBY VERSION
ruby 2.7.6p219

BUNDLED WITH
2.1.4

0 comments on commit e8adda1

Please sign in to comment.