From 0922ee12ff9fa7e7bfa0296b251d63c993c81245 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 8 Oct 2020 15:15:50 -0300 Subject: [PATCH] =?UTF-8?q?recompilar=20gemas=20seg=C3=BAn=20la=20versi?= =?UTF-8?q?=C3=B3n=20de=20alpine?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit de lo contrario los sitios que no hayan actualizado se van a romper --- Makefile | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index 4d83b2c5..5cc05903 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,8 @@ delegate := athshe assets := package.json yarn.lock $(shell find app/assets/ app/javascript/ -type f) +alpine_version := 3.12 + public/assets-production: $(assets) rm -rf $@ RAILS_ENV=production bundle exec rake assets:precompile @@ -45,42 +47,33 @@ load: ../gems/: mkdir -p $@ -ifeq ($(MAKECMDGOALS),convert-gems) gem_dir := $(shell readlink -f ../gems) +ifeq ($(MAKECMDGOALS),build-gems) gems := $(shell bundle show --paths | xargs -I {} sh -c 'test -f {}/ext/*/extconf.rb && basename {}') gems += $(shell bundle show --paths | xargs -I {} sh -c 'test -f {}/ext/extconf.rb && basename {}') -gems := $(patsubst %-x86_64-linux,%,$(gems)) -gems_musl := $(patsubst %,$(gem_dir)/%-x86_64-linux-musl.gem,$(gems)) -gems_gnu := $(patsubst %,$(gem_dir)/%-x86_64-linux.gem,$(gems)) +gems := $(patsubst %,$(gem_dir)/cache/%.gem,$(gems)) +gems_musl := $(patsubst $(gem_dir)/cache/%.gem,$(gem_dir)/$(alpine_version)/%-x86_64-linux-musl.gem,$(gems)) endif $(gem_dir)/%-x86_64-linux-musl.gem: - docker run \ + @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/"` \ + -e GEM=`echo $(notdir $*) | sed -re "s/-[^-]+$$//"` \ + -e VERSION=`echo $(notdir $*) | sed -re "s/.*-([^-]+)$$/\1/"` \ -e JOBS=2 \ - --rm \ - sutty/gem-compiler:latest - -$(gem_dir)/%-x86_64-linux.gem: - HTTP_BASIC_USER=$(HTTP_BASIC_USER) \ - HTTP_BASIC_PASSWORD=$(HTTP_BASIC_PASSWORD) \ - GEM=`echo $* | sed -re "s/-[^-]+$$//"` \ - VERSION=`echo $* | sed -re "s/.*-([^-]+)$$/\1/"` && \ - cd $(dir $@) && \ - gem fetch --source=https://gems.sutty.nl --platform=ruby \ - --version $${VERSION} $${GEM} && \ - gem compile -V --prune $${GEM}-$${VERSION}.gem && \ - gem inabox -o $@ \ - --host https://$${HTTP_BASIC_USER}:$${HTTP_BASIC_PASSWORD}@gems.sutty.nl + --rm -it \ + sutty/gem-compiler:latest || echo "No se pudo compilar $*" # 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_musl) +build-gems: $(gems_musl) + +cached_gems = $(wildcard $(gem_dir)/cache/*.gem) +rebuild_gems = $(patsubst $(gem_dir)/cache/%.gem,$(gem_dir)/$(alpine_version)/%-x86_64-linux-musl.gem,$(cached_gems)) +rebuild-gems: $(rebuild_gems) dirs := $(patsubst %,root/%,data sites deploy public)