Skip to content

Commit b60c825

Browse files
committed
Merge branch 'main' into re-add-multiple-convictions
2 parents 02fc834 + 52d6f6f commit b60c825

22 files changed

+197
-255
lines changed

.env.example

-2
This file was deleted.

.env.test.example

-3
This file was deleted.

.github/workflows/test.yml

-17
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,6 @@ jobs:
4242
with:
4343
bundler-cache: true
4444

45-
- name: Setup Node
46-
uses: actions/setup-node@v4
47-
with:
48-
node-version: 14.17.5
49-
50-
- name: Find yarn cache location
51-
id: yarn-cache
52-
run: echo "::set-output name=dir::$(yarn cache dir)"
53-
54-
- name: JS package cache
55-
uses: actions/cache@v4
56-
with:
57-
path: ${{ steps.yarn-cache.outputs.dir }}
58-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
59-
restore-keys: |
60-
${{ runner.os }}-yarn-
61-
6245
- name: Install packages
6346
run: |
6447
yarn install --pure-lockfile

.ruby-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.2.3
1+
3.3.4

Dockerfile

+30-47
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,49 @@
1-
FROM ruby:3.2.3-alpine as builder
1+
FROM ruby:3.3.4-alpine as base
2+
3+
WORKDIR /app
4+
5+
# postgresql-client: to run postgres, tzdata: required to set timezone, nodejs: JS runtime
6+
RUN apk add --no-cache \
7+
postgresql-client \
8+
tzdata \
9+
nodejs
10+
11+
# Ensure latest rubygems is installed
12+
RUN gem update --system
13+
14+
FROM base as builder
215

316
# build dependencies:
417
RUN apk add --no-cache \
18+
ruby-dev \
519
build-base \
620
postgresql-dev \
7-
tzdata \
821
yarn
922

10-
WORKDIR /app
11-
12-
COPY Gemfile* .ruby-version ./
23+
COPY Gemfile* .ruby-version package.json yarn.lock ./
1324

14-
RUN gem install bundler -v 2.4.19
1525
RUN bundle config deployment true && \
1626
bundle config without development test && \
17-
bundle install --jobs 4 --retry 3
18-
19-
# Install node packages defined in package.json
20-
COPY package.json yarn.lock ./
21-
RUN yarn install --frozen-lockfile --check-files
27+
bundle install --jobs 4 --retry 3 && \
28+
yarn install --frozen-lockfile
2229

2330
# Copy all files to /app
2431
COPY . .
2532

26-
# The following are ENV variables that need to be present by the time
27-
# the assets pipeline run, but doesn't matter their value.
28-
#
29-
ENV EXTERNAL_URL replace_this_at_build_time
30-
ENV SECRET_KEY_BASE replace_this_at_build_time
31-
ENV GOVUK_NOTIFY_API_KEY replace_this_at_build_time
32-
33-
ENV RAILS_ENV production
34-
RUN bundle exec rake assets:precompile
33+
RUN RAILS_ENV=production SECRET_KEY_BASE_DUMMY=1 \
34+
bundle exec rails assets:precompile
3535

3636
# Copy fonts and images (without digest) along with the digested ones,
3737
# as there are some hardcoded references in the `govuk-frontend` files
3838
# that will not be able to use the rails digest mechanism.
3939
RUN cp -r node_modules/govuk-frontend/dist/govuk/assets/. public/assets/
4040

41-
# tidy up installation
42-
RUN rm -rf log/* tmp/* /tmp && \
43-
rm -rf /usr/local/bundle/cache && \
44-
find /usr/local/bundle/gems -name "*.c" -delete && \
45-
find /usr/local/bundle/gems -name "*.h" -delete && \
46-
find /usr/local/bundle/gems -name "*.o" -delete && \
47-
find /usr/local/bundle/gems -name "*.html" -delete
41+
# Cleanup to save space in the production image
42+
RUN rm -rf node_modules log/* tmp/* /tmp && \
43+
rm -rf /usr/local/bundle/cache
4844

4945
# Build runtime image
50-
FROM ruby:3.2.3-alpine
51-
52-
# The application runs from /app
53-
WORKDIR /app
54-
55-
# libpq: required to run postgres, tzdata: required to set timezone, nodejs: JS runtime
56-
RUN apk add --no-cache libpq tzdata nodejs
46+
FROM base
5747

5848
# add non-root user and group with alpine first available uid, 1000
5949
RUN addgroup -g 1000 -S appgroup && \
@@ -65,21 +55,14 @@ COPY --from=builder /usr/local/bundle/ /usr/local/bundle/
6555

6656
# Create log and tmp
6757
RUN mkdir -p log tmp
68-
RUN chown -R appuser:appgroup db log tmp
58+
RUN chown -R appuser:appgroup ./*
6959

70-
ARG APP_BUILD_DATE
71-
ENV APP_BUILD_DATE ${APP_BUILD_DATE}
60+
# Set user
61+
USER 1000
7262

63+
ARG APP_BUILD_DATE
7364
ARG APP_BUILD_TAG
74-
ENV APP_BUILD_TAG ${APP_BUILD_TAG}
75-
7665
ARG APP_GIT_COMMIT
66+
ENV APP_BUILD_DATE ${APP_BUILD_DATE}
67+
ENV APP_BUILD_TAG ${APP_BUILD_TAG}
7768
ENV APP_GIT_COMMIT ${APP_GIT_COMMIT}
78-
79-
ENV APPUID 1000
80-
USER $APPUID
81-
82-
ENV PUMA_PORT 3000
83-
EXPOSE $PUMA_PORT
84-
85-
ENTRYPOINT ["./run.sh"]

Gemfile

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
33

44
ruby File.read(".ruby-version").strip
55

6-
# Reduces boot times through caching; required in config/boot.rb
7-
gem "bootsnap", ">= 1.1.0", require: false
86
gem "govuk-components", "~> 5.4"
97
gem "govuk_design_system_formbuilder"
108
gem "jquery-rails"
@@ -40,7 +38,7 @@ end
4038
group :test do
4139
gem "brakeman"
4240
gem "capybara"
43-
gem "cucumber", "< 9.0.0"
41+
gem "cucumber", "< 10.0.0"
4442
gem "cucumber-rails", require: false
4543
gem "rails-controller-testing"
4644
gem "rubocop-govuk", require: false

0 commit comments

Comments
 (0)