-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2826 from alphagov/nsabri1/update-base-image
Update to use new Minideb Ruby base image
- Loading branch information
Showing
1 changed file
with
9 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |