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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
RUBY_VERSION: [2.3, 2.4, 2.5, 2.6, 2.7, 3.1, 3.2, 3.3, 3.4]
RUBY_VERSION: [3.3, 3.4]
env:
RUBY_VERSION: ${{ matrix.RUBY_VERSION }}
steps:
Expand Down
10 changes: 4 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
ARG RUBY_VERSION=2.3.1
ARG RUBY_VERSION=3.4
FROM ruby:${RUBY_VERSION}

ARG BUNDLER_VERSION=1.17.3
ENV BUNDLER_VERSION=${BUNDLER_VERSION}
RUN if [ "${BUNDLER_VERSION}" != "" ] ; then \
gem install bundler -v "${BUNDLER_VERSION}" ; \
fi
RUN apt-get upgrade -y ca-certificates

RUN egrep '^mozilla/emSign_ECC_Root_CA_-_G3.crt|^mozilla/Comodo_AAA_Services_root.crt' /etc/ca-certificates.conf; [ $? -eq 1 ]

WORKDIR /app
COPY Gemfile /app/
Expand Down
48 changes: 5 additions & 43 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,42 +1,7 @@

export COMPOSE_IGNORE_ORPHANS ?= true
export RUBY_VERSION ?= 2.3.1
RUBY_VERSION_MAJOR = $(word 1,$(subst ., ,$(RUBY_VERSION)))
RUBY_VERSION_MINOR = $(word 2,$(subst ., ,$(RUBY_VERSION)))
export BUNDLER_VERSION ?=
ifeq ($(BUNDLER_VERSION),)
ifeq ($(RUBY_VERSION_MAJOR),2)
# Use old bundler for Ruby 2.3-2.6; Ruby 2.7 needs bundler 2.x to avoid resolver bugs
ifeq ($(RUBY_VERSION_MINOR),7)
export BUNDLER_VERSION = 2.4.22
else
export BUNDLER_VERSION = 1.17.3
endif
endif
endif
PROJECT_NAME = $(shell ls *.gemspec | sed 's/\.gemspec//')
export COMPOSE_PROJECT_NAME ?= $(PROJECT_NAME)-$(subst .,_,$(RUBY_VERSION))

default: help

## Show this help message
help:
@echo "\n\033[1;34mAvailable targets:\033[0m\n"
@awk 'BEGIN {FS = ":"; prev = ""} \
/^## / {prev = substr($$0, 4); next} \
/^[a-zA-Z_-]+:/ {if (prev != "") printf " \033[1;36m%-20s\033[0m %s\n", $$1, prev; prev = ""} \
{prev = ""}' $(MAKEFILE_LIST) | sort
@echo

BUILD_ARGS ?=
## Build and pull docker compose images
build: gemfile-lock
docker compose build --pull $(BUILD_ARGS)

## Create a Gemfile.lock specific to the container (i.e., for the ruby version)
gemfile-lock:
mkdir -pv ./docker/ruby-$(RUBY_VERSION)/ && \
echo '' > ./docker/ruby-$(RUBY_VERSION)/Gemfile.lock
build:
touch docker/Gemfile.lock
docker compose build --pull

## Open shell in a docker container, supports CMD=
bash: build
Expand Down Expand Up @@ -64,11 +29,8 @@ lint-direct:
$(MAKE) run CMD="bundle exec rake rubocop $(ARGS)"

## Clean up docker compose resources
clean: clean-gemfile-lock
clean:
truncate -s 0 docker/Gemfile.lock && \
docker compose down --remove-orphans --volumes

## Clean up the container specific Gemfile.lock
clean-gemfile-lock:
rm -v ./docker/ruby-$(RUBY_VERSION)/Gemfile.lock ||:

.PHONY: build bash test
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ services:
build:
context: .
args:
RUBY_VERSION: ${RUBY_VERSION:-2.3.1}
RUBY_VERSION: ${RUBY_VERSION:-3.4}
BUNDLER_VERSION: ${BUNDLER_VERSION:-}
volumes:
- type: bind
source: .
target: /app
- ./docker/ruby-${RUBY_VERSION}/Gemfile.lock:/app/Gemfile.lock
- ./docker/Gemfile.lock:/app/Gemfile.lock
Empty file added docker/.keep
Empty file.
Loading