diff --git a/.ruby-version b/.ruby-version index 0cadbc1e..35d16fb1 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.5.5 +2.5.7 diff --git a/Gemfile b/Gemfile index 2d169738..ce16e8a9 100644 --- a/Gemfile +++ b/Gemfile @@ -14,6 +14,8 @@ git_source(:github) do |repo_name| "https://github.com/#{repo_name}.git" end +ruby '2.5.7' + gem 'dotenv-rails', require: 'dotenv/rails-now' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' diff --git a/Gemfile.lock b/Gemfile.lock index 978e8924..871b07bc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -487,5 +487,8 @@ DEPENDENCIES webpacker yaml_db! +RUBY VERSION + ruby 2.5.7p206 + BUNDLED WITH 2.0.2 diff --git a/Makefile b/Makefile index c1d5d4f1..226328d2 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ # Incluir las variables de entorno -include .env +mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) +root_dir := $(patsubst %/,%,$(dir $(mkfile_path))) +include $(root_dir)/.env # Limpiar los archivos de testeo clean: @@ -13,19 +15,38 @@ build: ../gems/: mkdir -p $@ +gem_dir := $(shell readlink -f ../gems) +gems := $(shell bundle show --paths | xargs -I {} sh -c 'test -d {}/ext && basename {}') +gems_musl := $(patsubst %,$(gem_dir)/%-x86_64-linux-musl.gem,$(gems)) + +$(gem_dir)/%-x86_64-linux-musl.gem: + docker run \ + -v $(gem_dir):/srv/gems \ + -v `readlink -f ~/.ccache`:/home/builder/.ccache \ + -e HTTP_BASIC_USER=$(HTTP_BASIC_USER) \ + -e HTTP_BASIC_PASSWORD=$(HTTP_BASIC_PASSWORD) \ + -e GEM=`echo $* | sed -re "s/-[^-]+$$//"` \ + -e VERSION=`echo $* | sed -re "s/.*-([^-]+)$$/\1/"` \ + sutty/gem-compiler:latest + # Compilar todas las gemas binarias y subirlas a gems.sutty.nl para que # al crear el contenedor no tengamos que compilarlas cada vez -convert-gems: ../gems/ - bundle show --paths \ - | xargs -I {} sh -c 'test -d {}/ext && basename {}' \ - | sed -re "s/-([^-]+)$$/\t\1/" \ - | while read gem version; do \ - docker run \ - -v `readlink -f $<`:/srv/gems \ - -v `readlink -f ~/.ccache`:/home/builder/.ccache \ - -e HTTP_BASIC_USER=$(HTTP_BASIC_USER) \ - -e HTTP_BASIC_PASSWORD=$(HTTP_BASIC_PASSWORD) \ - -e GEM=$$gem \ - -e VERSION=$$version \ - sutty/gem-compiler:latest ; \ - done +convert-gems: $(gems_musl) + +dirs := $(patsubst %,root/%,data sites deploy public) + +$(dirs): + mkdir -p $@ + +test-container: $(dirs) + docker run -v $(PWD)/root/data:/srv/http/data \ + -v $(PWD)/root/sites:/srv/http/_sites \ + -v $(PWD)/root/deploy:/srv/http/_deploy \ + -v $(PWD)/root/public:/srv/http/_public \ + -v $(PWD)/config/credentials.yml.enc:/srv/http/config/credentials.yml.enc \ + -e RAILS_MASTER_KEY=`cat config/master.key` \ + -it \ + --rm \ + --name=sutty \ + sutty/sutty \ + /bin/sh