diff --git a/Dockerfile b/Dockerfile index b2a578c3..c1c3fe68 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,6 +19,7 @@ ARG BUNDLE_INSTALL_FLAGS="" ARG RUN_PRECOMPILATION=true ARG SENTRY_DSN="" ARG CLOUDWATCH_LINK="" +ARG BUILD_DEV # required for certain linting tools that read files, such as erb-lint ENV LANG='C.UTF-8' \ @@ -36,6 +37,10 @@ ENV LANG='C.UTF-8' \ RUN apk add --no-cache --virtual .build-deps build-base && \ apk add --no-cache gcompat nodejs yarn mysql-dev mysql-client bash make bind shadow freeradius +RUN if [ "${BUILD_DEV}" = "true" ] ; then \ + apk add --no-cache alpine-sdk ruby-dev; \ + fi + RUN groupadd -g $UID -o $GROUP && \ useradd -m -u $UID -g $UID -o -s /bin/false $USER && \ mkdir -p $APPDIR && \ diff --git a/Gemfile.lock b/Gemfile.lock index ebcec582..59ccb64e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,67 +1,67 @@ GEM remote: https://rubygems.org/ specs: - actioncable (7.0.8.1) - actionpack (= 7.0.8.1) - activesupport (= 7.0.8.1) + actioncable (7.0.8.4) + actionpack (= 7.0.8.4) + activesupport (= 7.0.8.4) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.8.1) - actionpack (= 7.0.8.1) - activejob (= 7.0.8.1) - activerecord (= 7.0.8.1) - activestorage (= 7.0.8.1) - activesupport (= 7.0.8.1) + actionmailbox (7.0.8.4) + actionpack (= 7.0.8.4) + activejob (= 7.0.8.4) + activerecord (= 7.0.8.4) + activestorage (= 7.0.8.4) + activesupport (= 7.0.8.4) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.8.1) - actionpack (= 7.0.8.1) - actionview (= 7.0.8.1) - activejob (= 7.0.8.1) - activesupport (= 7.0.8.1) + actionmailer (7.0.8.4) + actionpack (= 7.0.8.4) + actionview (= 7.0.8.4) + activejob (= 7.0.8.4) + activesupport (= 7.0.8.4) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.8.1) - actionview (= 7.0.8.1) - activesupport (= 7.0.8.1) + actionpack (7.0.8.4) + actionview (= 7.0.8.4) + activesupport (= 7.0.8.4) rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.8.1) - actionpack (= 7.0.8.1) - activerecord (= 7.0.8.1) - activestorage (= 7.0.8.1) - activesupport (= 7.0.8.1) + actiontext (7.0.8.4) + actionpack (= 7.0.8.4) + activerecord (= 7.0.8.4) + activestorage (= 7.0.8.4) + activesupport (= 7.0.8.4) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.8.1) - activesupport (= 7.0.8.1) + actionview (7.0.8.4) + activesupport (= 7.0.8.4) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.8.1) - activesupport (= 7.0.8.1) + activejob (7.0.8.4) + activesupport (= 7.0.8.4) globalid (>= 0.3.6) - activemodel (7.0.8.1) - activesupport (= 7.0.8.1) - activerecord (7.0.8.1) - activemodel (= 7.0.8.1) - activesupport (= 7.0.8.1) - activestorage (7.0.8.1) - actionpack (= 7.0.8.1) - activejob (= 7.0.8.1) - activerecord (= 7.0.8.1) - activesupport (= 7.0.8.1) + activemodel (7.0.8.4) + activesupport (= 7.0.8.4) + activerecord (7.0.8.4) + activemodel (= 7.0.8.4) + activesupport (= 7.0.8.4) + activestorage (7.0.8.4) + actionpack (= 7.0.8.4) + activejob (= 7.0.8.4) + activerecord (= 7.0.8.4) + activesupport (= 7.0.8.4) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.8.1) + activesupport (7.0.8.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -94,7 +94,7 @@ GEM base64 (0.2.0) bcrypt (3.1.18) bigdecimal (3.1.8) - builder (3.2.4) + builder (3.3.0) byebug (11.1.3) cancancan (3.5.0) capybara (3.40.0) @@ -106,7 +106,7 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - concurrent-ruby (1.2.3) + concurrent-ruby (1.3.3) crack (1.0.0) bigdecimal rexml @@ -128,7 +128,7 @@ GEM dotenv-rails (2.8.1) dotenv (= 2.8.1) railties (>= 3.2) - erubi (1.12.0) + erubi (1.13.0) factory_bot (6.2.0) activesupport (>= 5.0.0) factory_bot_rails (6.2.0) @@ -175,12 +175,12 @@ GEM matrix (0.4.2) method_source (1.1.0) mini_mime (1.1.5) - mini_portile2 (2.8.6) - minitest (5.22.3) + mini_portile2 (2.8.7) + minitest (5.24.1) multi_json (1.15.0) multi_xml (0.6.0) mysql2 (0.5.5) - net-imap (0.4.11) + net-imap (0.4.14) date net-protocol net-pop (0.1.2) @@ -190,7 +190,7 @@ GEM net-smtp (0.5.0) net-protocol nio4r (2.7.3) - nokogiri (1.16.5) + nokogiri (1.16.7) mini_portile2 (~> 2.8.2) racc (~> 1.4) oauth2 (1.4.9) @@ -218,26 +218,26 @@ GEM public_suffix (5.0.5) puma (6.4.2) nio4r (~> 2.0) - racc (1.7.3) + racc (1.8.1) rack (2.2.9) rack-protection (2.2.0) rack rack-test (2.1.0) rack (>= 1.3) - rails (7.0.8.1) - actioncable (= 7.0.8.1) - actionmailbox (= 7.0.8.1) - actionmailer (= 7.0.8.1) - actionpack (= 7.0.8.1) - actiontext (= 7.0.8.1) - actionview (= 7.0.8.1) - activejob (= 7.0.8.1) - activemodel (= 7.0.8.1) - activerecord (= 7.0.8.1) - activestorage (= 7.0.8.1) - activesupport (= 7.0.8.1) + rails (7.0.8.4) + actioncable (= 7.0.8.4) + actionmailbox (= 7.0.8.4) + actionmailer (= 7.0.8.4) + actionpack (= 7.0.8.4) + actiontext (= 7.0.8.4) + actionview (= 7.0.8.4) + activejob (= 7.0.8.4) + activemodel (= 7.0.8.4) + activerecord (= 7.0.8.4) + activestorage (= 7.0.8.4) + activesupport (= 7.0.8.4) bundler (>= 1.15.0) - railties (= 7.0.8.1) + railties (= 7.0.8.4) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -245,9 +245,9 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.0.8.1) - actionpack (= 7.0.8.1) - activesupport (= 7.0.8.1) + railties (7.0.8.4) + actionpack (= 7.0.8.4) + activesupport (= 7.0.8.4) method_source rake (>= 12.2) thor (~> 1.0) @@ -372,7 +372,7 @@ GEM websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.13) + zeitwerk (2.6.17) PLATFORMS ruby diff --git a/Makefile b/Makefile index ee92b8c8..44913ee1 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,11 @@ build: ## Docker build image .PHONY: build-dev build-dev: ## Build-dev image - $(DOCKER_COMPOSE) build + $(DOCKER_COMPOSE) build --build-arg BUILD_DEV="true" + +.PHONY: shell-dev +shell-dev: ## Run application and start shell + $(DOCKER_COMPOSE) run --rm app sh .PHONY: start-db start-db: ## Start database diff --git a/README.md b/README.md index 643ae30c..fd3f89a9 100644 --- a/README.md +++ b/README.md @@ -162,3 +162,26 @@ To upload a new server certificate, follow these steps: - Terraform module - module "network-access-control-admin" - AWS Account - MOJ Official (Shared Services) - [Pipeline "network-access-control-server"](https://eu-west-2.console.aws.amazon.com/codesuite/codepipeline/pipelines/network-access-control-admin/view?region=eu-west-2) + +## Updating Gems + +Developer tools (alpine-sdk, ruby-dev) have been added to the container to facilitate Gem version updates. To update a Gem version: +- Build and run tests to make sure you have a baseline of the application running well. + +- Build the dev container +```bash + make build-dev +``` +- Run the application with an interactive shell +```bash + make shell-dev +``` +- Change the version in the Gemfile +- In the interactive shell run a bundle update for the Gem being updated, e.g. + +```bash + bundle update rails +``` +- Check that the Gemfile.lock has the new version + +- Destroy container, re-build and run tests. diff --git a/docker-compose.yml b/docker-compose.yml index b0142963..c0b14b9a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,7 +19,7 @@ services: context: . args: UID: "${UID}" - BUNDLE_INSTALL_FLAGS: "${BUNDLE_INSTALL_FLAGS:- --jobs 20 --retry 5}" + BUNDLE_INSTALL_FLAGS: "${BUNDLE_INSTALL_FLAGS:- --jobs 20 --retry 5 --full-index}" user: "${UID}:${UID}" command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'" volumes: