5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-14 17:11:41 +00:00
panel/Makefile

60 lines
1.9 KiB
Makefile
Raw Normal View History

2019-09-18 18:47:43 +00:00
# Incluir las variables de entorno
2019-10-16 17:56:49 +00:00
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
root_dir := $(patsubst %/,%,$(dir $(mkfile_path)))
include $(root_dir)/.env
2019-09-18 18:47:43 +00:00
# Limpiar los archivos de testeo
clean:
rm -rf _sites/test-* _deploy/test-*
# Generar la imagen Docker
build:
docker build --build-arg="RAILS_MASTER_KEY=`cat config/master.key`" -t sutty/sutty .
2019-11-16 23:13:30 +00:00
save:
docker save sutty/sutty:latest | gzip > sutty.latest.gz
scp sutty.latest.gz root@sutty.nl:
load:
ssh root@sutty.nl sh -c "gunzip -c sutty.latest.gz | docker load"
2019-09-18 18:47:43 +00:00
# Crear el directorio donde se almacenan las gemas binarias
../gems/:
mkdir -p $@
2019-10-16 17:56:49 +00:00
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
2019-09-18 18:47:43 +00:00
# Compilar todas las gemas binarias y subirlas a gems.sutty.nl para que
# al crear el contenedor no tengamos que compilarlas cada vez
2019-10-16 17:56:49 +00:00
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