Skip to content

Commit

Permalink
Merge pull request #2826 from alphagov/nsabri1/update-base-image
Browse files Browse the repository at this point in the history
Update to use new Minideb Ruby base image
  • Loading branch information
nsabri1 authored Aug 9, 2022
2 parents 57fca93 + 15086af commit 51dfc94
Showing 1 changed file with 9 additions and 21 deletions.
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.6
ARG builder_image=ghcr.io/alphagov/govuk-ruby-builder:2.7.6

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

0 comments on commit 51dfc94

Please sign in to comment.