Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1f49486870 | ||
|
|
06f7cfbfad | ||
|
|
e1b92278a5 | ||
|
|
b3c50f4694 | ||
|
|
7dd05ac92f | ||
|
|
800a82045d | ||
|
|
c96dec4692 | ||
|
|
417c126777 | ||
|
|
1205192e8a | ||
|
|
aa2f547856 | ||
|
|
57e72de021 | ||
|
|
15ae2b8221 | ||
|
|
f895b7979d | ||
|
|
bec7f067bc | ||
|
|
e50a3e80e9 | ||
|
|
afb0b931c5 | ||
|
|
fb1568259b | ||
|
|
c1049bf69d | ||
|
|
b05fe5b302 | ||
|
|
505eda01a3 | ||
|
|
d329cbd6ef |
@@ -17,9 +17,15 @@ COPY assets/favicon /usr/share/nginx/html/assets/favicon
|
|||||||
COPY assets/video /usr/share/nginx/html/assets/video
|
COPY assets/video /usr/share/nginx/html/assets/video
|
||||||
|
|
||||||
# Le immagini e i font citati da index.html e style.css prendono ?v=<versione>, come quelli caricati dal codice.
|
# Le immagini e i font citati da index.html e style.css prendono ?v=<versione>, come quelli caricati dal codice.
|
||||||
|
# Alla versione si aggiunge l'impronta del contenuto di assets/: uno sfondo rifatto senza cambiare versione (in
|
||||||
|
# locale, fra un bump e l'altro) ha un indirizzo nuovo, e il browser non tiene quello vecchio dalla cache lunga.
|
||||||
RUN cd /usr/share/nginx/html \
|
RUN cd /usr/share/nginx/html \
|
||||||
&& V=$(sed -n "s/^export const VERSION = '\([0-9.]*\)';$/\1/p" src/version.js) \
|
&& V=$(sed -n "s/^export const VERSION = '\([0-9.]*\)';$/\1/p" src/version.js) \
|
||||||
&& test -n "$V" \
|
&& test -n "$V" \
|
||||||
|
&& H=$(find assets -type f -exec md5sum {} + | sort -k2 | md5sum | cut -c1-8) \
|
||||||
|
&& sed -i -E 's#v=\$\{VERSION\}#v=${VERSION}-'"$H"'#' src/version.js \
|
||||||
|
&& grep -q "VERSION}-$H" src/version.js \
|
||||||
|
&& V="$V-$H" \
|
||||||
&& sed -i -E "s#url\((assets/[^)]*)\)#url(\1?v=$V)#g" style.css \
|
&& sed -i -E "s#url\((assets/[^)]*)\)#url(\1?v=$V)#g" style.css \
|
||||||
&& sed -i -E "s#src=\"(assets/[^\"]*)\"#src=\"\1?v=$V\"#g" index.html \
|
&& sed -i -E "s#src=\"(assets/[^\"]*)\"#src=\"\1?v=$V\"#g" index.html \
|
||||||
&& grep -q "?v=$V" style.css && grep -q "?v=$V" index.html
|
&& grep -q "?v=$V" style.css && grep -q "?v=$V" index.html
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ CROP ?=
|
|||||||
COLORS ?= 64
|
COLORS ?= 64
|
||||||
|
|
||||||
.PHONY: help serve open test browser verify check-public bump voci voci-elenco sfondi sfondi-genera sfondi-confronto background character \
|
.PHONY: help serve open test browser verify check-public bump voci voci-elenco sfondi sfondi-genera sfondi-confronto background character \
|
||||||
build up down restart logs ps shell image-size deploy deploy-logs clean distclean
|
build up down restart logs ps shell image-size deploy deploy-vps deploy-logs clean distclean
|
||||||
|
|
||||||
## ------------------------------------------------------------ sviluppo
|
## ------------------------------------------------------------ sviluppo
|
||||||
|
|
||||||
@@ -124,6 +124,8 @@ image-size: ## Dimensione dell'immagine
|
|||||||
# Host e indirizzo stanno in deploy.local.mk, fuori da git, per esempio:
|
# Host e indirizzo stanno in deploy.local.mk, fuori da git, per esempio:
|
||||||
# DEPLOY_HOST = root@mio-server
|
# DEPLOY_HOST = root@mio-server
|
||||||
# DEPLOY_URL = https://gioco.esempio
|
# DEPLOY_URL = https://gioco.esempio
|
||||||
|
# VPS_HOST = mio-vps (facoltativo: una seconda copia, con make deploy-vps)
|
||||||
|
# VPS_DIR = docker/leggenda-regolo
|
||||||
-include deploy.local.mk
|
-include deploy.local.mk
|
||||||
DEPLOY_DIR ?= /root/leggenda-regolo
|
DEPLOY_DIR ?= /root/leggenda-regolo
|
||||||
DEPLOY_TMP := $(shell mktemp -d -u /tmp/regolo-deploy.XXXXXX)
|
DEPLOY_TMP := $(shell mktemp -d -u /tmp/regolo-deploy.XXXXXX)
|
||||||
@@ -151,6 +153,16 @@ deploy: ## Pubblica l'ultimo commit: test, immagine costruita e provata qui, spe
|
|||||||
xargs -r -I{} docker image rm -f $(IMAGE):{} >/dev/null
|
xargs -r -I{} docker image rm -f $(IMAGE):{} >/dev/null
|
||||||
@echo "→ $(DEPLOY_URL) ($$(git log -1 --format='%h %s'))"
|
@echo "→ $(DEPLOY_URL) ($$(git log -1 --format='%h %s'))"
|
||||||
|
|
||||||
|
deploy-vps: ## Spedisce al VPS (VPS_HOST, VPS_DIR in deploy.local.mk) l'immagine dell'ultimo commit già provata da make deploy
|
||||||
|
@test -n "$(VPS_HOST)" -a -n "$(VPS_DIR)" || { echo "mancano VPS_HOST e VPS_DIR: scrivili in deploy.local.mk"; exit 2; }
|
||||||
|
@docker image inspect $(IMAGE):$$(git rev-parse --short HEAD) >/dev/null 2>&1 || \
|
||||||
|
{ echo "manca l'immagine dell'ultimo commit ($$(git rev-parse --short HEAD)): prima make deploy"; exit 1; }
|
||||||
|
ssh $(VPS_HOST) 'mkdir -p $(VPS_DIR)'
|
||||||
|
git show HEAD:docker-compose.homeserver.yml | ssh $(VPS_HOST) 'cat > $(VPS_DIR)/docker-compose.yml'
|
||||||
|
docker save $(IMAGE):$$(git rev-parse --short HEAD) $(IMAGE):latest | gzip | \
|
||||||
|
ssh $(VPS_HOST) 'gunzip | docker load -q && cd $(VPS_DIR) && docker compose up -d && docker image prune -f >/dev/null'
|
||||||
|
@ssh $(VPS_HOST) "docker exec $(IMAGE) grep -o \"VERSION = '[^']*'\" /usr/share/nginx/html/src/version.js" | sed 's/^/→ $(VPS_HOST): /'
|
||||||
|
|
||||||
deploy-logs: ## Log del container sul server di deploy
|
deploy-logs: ## Log del container sul server di deploy
|
||||||
@test -n "$(DEPLOY_HOST)" || { echo "manca DEPLOY_HOST: scrivilo in deploy.local.mk"; exit 2; }
|
@test -n "$(DEPLOY_HOST)" || { echo "manca DEPLOY_HOST: scrivilo in deploy.local.mk"; exit 2; }
|
||||||
ssh $(DEPLOY_HOST) 'cd $(DEPLOY_DIR) && docker compose logs -f --tail 50'
|
ssh $(DEPLOY_HOST) 'cd $(DEPLOY_DIR) && docker compose logs -f --tail 50'
|
||||||
|
|||||||
|
After Width: | Height: | Size: 526 KiB |
|
After Width: | Height: | Size: 32 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 7.7 KiB |
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 6.1 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 175 KiB |
|
After Width: | Height: | Size: 475 KiB |
|
After Width: | Height: | Size: 224 KiB |
|
After Width: | Height: | Size: 456 KiB |
|
After Width: | Height: | Size: 280 KiB |
|
After Width: | Height: | Size: 233 KiB |
|
After Width: | Height: | Size: 228 KiB |