5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-14 06:21:42 +00:00

recompilar gemas según la versión de alpine

de lo contrario los sitios que no hayan actualizado se van a romper
This commit is contained in:
f 2020-10-08 15:15:50 -03:00
parent 32803d8b44
commit 0922ee12ff

View file

@ -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)