Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# [Choice] Ruby version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.1, 3.0, 2, 2.7, 2.6, 3-bullseye, 3.1-bullseye, 3.0-bullseye, 2-bullseye, 2.7-bullseye, 2.6-bullseye, 3-buster, 3.1-buster, 3.0-buster, 2-buster, 2.7-buster, 2.6-buster
ARG VARIANT=2.7
# [Choice] Ruby version: 3.4.7
ARG VARIANT=3.4.7
FROM mcr.microsoft.com/devcontainers/ruby:${VARIANT}

# Install Rails
Expand Down
29 changes: 11 additions & 18 deletions .docker/production/Dockerfile.gha
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,33 @@
### Base image ###
############################################

ARG RUBY_VERSION=2.7.6
FROM ruby:$RUBY_VERSION-slim-buster as base
ARG RUBY_VERSION=3.4.7
FROM ruby:$RUBY_VERSION-slim-trixie AS base
LABEL author="IdeaCrew"

ENV USERNAME=quoting_tool

ARG DEBIAN_FRONTEND=noninteractive

ARG BUNDLER_VERSION=2.3.26
ARG BUNDLER_VERSION=2.6.9
ENV BUNDLER_VERSION=$BUNDLER_VERSION

# Only install what's needed that isn't in the base image
# https://github.com/docker-library/ruby/blob/master/2.7/slim-buster/Dockerfile
# Buster is EOL; point apt sources to the Debian archive and disable
# Release file validity checks so updates/installations work.
RUN sed -i \
-e 's|deb.debian.org/debian|archive.debian.org/debian|g' \
-e 's|security.debian.org/debian-security|archive.debian.org/debian-security|g' \
/etc/apt/sources.list \
&& apt-get -o Acquire::Check-Valid-Until=false update \
RUN apt-get update \
&& apt-get -yq dist-upgrade \
&& apt-get install -y \
fontconfig \
libffi6 \
libffi8 \
libsodium23 \
libxext6 \
libxrender1 \
libyaml-cpp0.6 \
openjdk-11-jre \
libyaml-cpp0.8 \
openjdk-21-jre \
openssl \
ruby-dalli \
sshpass \
unzip \
zip \
zlibc \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& truncate -s 0 /var/log/*log
Expand Down Expand Up @@ -76,7 +68,7 @@ ENV NODE_ENV=production
################################################################################
### Builder. Adds node and Yarn. Not necessary in production. ###
###############################################################################
FROM base as builder
FROM base AS builder

ARG DEBIAN_FRONTEND=noninteractive

Expand All @@ -85,13 +77,14 @@ RUN apt-get update -qq \
build-essential \
git \
libpq-dev \
libyaml-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& truncate -s 0 /var/log/*log

### Install dependencies

FROM builder as prod_gems_and_assets
FROM builder AS prod_gems_and_assets

COPY --chown=$USERNAME:$USERNAME ./Gemfile $HOME/Gemfile
COPY --chown=$USERNAME:$USERNAME ./Gemfile.lock $HOME/Gemfile.lock
Expand All @@ -103,7 +96,7 @@ RUN bundle config set --local without 'development test' \
# Deployable image
################################################################

FROM base as deploy
FROM base AS deploy

ARG HOSTNAME=localhost

Expand Down
17 changes: 8 additions & 9 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
steps:
- name: Git branch name
id: git-branch-name
uses: EthanSK/git-branch-name-action@v1
run: echo "GIT_BRANCH_NAME=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV
- name: Prepare info
id: prep
run: |
Expand All @@ -52,18 +52,18 @@ jobs:
needs: [prep]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Add git HEAD info to docker image
run: git show --quiet HEAD > release.txt

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v4
with:
install: true

- name: Cache Docker layers
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
# Key is named differently to avoid collision
Expand All @@ -72,14 +72,14 @@ jobs:
${{ runner.os }}-multi-buildx

- name: Login to GHCR
uses: docker/login-action@v2
uses: docker/login-action@v4
with:
registry: ${{ needs.prep.outputs.registry }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v6
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
Expand All @@ -100,7 +100,7 @@ jobs:
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new

- name: Setup cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: cache
key: ${{ runner.os }}-cache-${{ hashFiles('**/sysdig-cli-scanner', '**/latest_version.txt', '**/db/main.db.meta.json', '**/scanner-cache/inlineScannerCache.db') }}
Expand All @@ -112,7 +112,6 @@ jobs:
uses: anchore/scan-action@main
with:
image: ghcr.io/${{ needs.prep.outputs.taggedImage }}
acs-report-enable: true
fail-build: false
severity-cutoff: critical

Expand All @@ -138,7 +137,7 @@ jobs:

- name: Upload anchore scan SARIF report
if: github.event_name != 'pull_request'
uses: github/codeql-action/upload-sarif@v2
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: ${{ steps.scan.outputs.sarif }}

Expand Down
4 changes: 3 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ AllCops:
- "./db/seedfiles/**/*"
- "./clients/**/*"

Metrics/LineLength:
Layout/LineLength:
Max: 200
Metrics/AbcSize:
Max: 50
Expand All @@ -22,6 +22,8 @@ Metrics/MethodLength:
Max: 50
Metrics/PerceivedComplexity:
Max: 15
Naming/VariableNumber:
Enabled: false
GlobalVars:
AllowedVariables:
- $rates
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby-2.7.6
3.4.7
38 changes: 17 additions & 21 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.7.6'
ruby '3.4.7'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'activemodel', '~> 6.0.0'
gem 'rails', '~> 6.0.0'
gem 'rails', '~> 8.1.2.1'

# Use Puma as the app server
gem 'puma', '~> 3.12'
gem 'puma', '~> 7.2'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
# gem 'jbuilder', '~> 2.7'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false
gem 'bootsnap', '~> 1.24', '>= 1.24.2', require: false

# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
gem 'aws-sdk'
Expand All @@ -27,44 +25,42 @@ gem 'responders'

# MongoDB NoSQL database ORM
# gem 'mongoid', '~> 7.0'
gem 'mongoid', git: 'https://github.com/mongodb/mongoid.git', branch: 'master'
gem 'mongoid', '9.0.9'

# Settings, validation and dependency injection
gem 'fast_jsonapi'
gem 'money-rails', '~> 1.13'
gem 'csv'
gem 'jsonapi-serializer'
gem 'money-rails', '~> 3.0'
gem 'nokogiri', '~> 1.10'
gem 'nokogiri-happymapper', '~> 0.8.0', require: 'happymapper'
gem 'resource_registry', git: 'https://github.com/ideacrew/resource_registry.git', branch: 'trunk'
gem 'observer'
gem 'resource_registry', git: 'https://github.com/ideacrew/resource_registry.git', tag: 'v0.11.0'
gem 'roo', '~> 2.1'
gem 'roo-xls'
gem 'virtus', '~> 1.0'

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: %i[mri mingw x64_mingw]
gem 'byebug', '~> 13.0', platforms: %i[mri mingw x64_mingw]
gem 'climate_control'
gem 'factory_bot_rails', '~> 4.11'
gem 'pry-byebug'
gem 'rspec-rails', '~> 3.8'
gem 'pry-byebug', '~> 3.12'
gem 'rspec-rails', '~> 8.0', '>= 8.0.4'
gem 'yard' # , '~> 0.9.12', require: false
end

group :development do
gem 'listen', '>= 3.0.5', '< 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
gem 'listen', '~> 3.10'

# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
gem 'web-console', '>= 3'

gem 'rubocop', require: false
gem 'rubocop-git'
gem 'rubocop-rspec'
gem 'rubocop', '~> 1.86', '>= 1.86.1'
gem 'rubocop-git', '~> 0.1.3'
end

group :test do
gem 'database_cleaner'
gem 'database_cleaner-mongoid', '~> 2.0', '>= 2.0.1'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
Expand Down
Loading
Loading