Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A1dxvtsZx8NE9fwjXUNDBr
29 lines
1.3 KiB
Docker
29 lines
1.3 KiB
Docker
# LA LEGGENDA DEL REGOLO: gioco statico servito da nginx.
|
|
FROM nginx:1.27-alpine
|
|
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
COPY index.html style.css /usr/share/nginx/html/
|
|
COPY src /usr/share/nginx/html/src
|
|
COPY assets/scenes /usr/share/nginx/html/assets/scenes
|
|
COPY assets/characters /usr/share/nginx/html/assets/characters
|
|
COPY assets/audio /usr/share/nginx/html/assets/audio
|
|
COPY assets/icons /usr/share/nginx/html/assets/icons
|
|
COPY assets/fonts /usr/share/nginx/html/assets/fonts
|
|
COPY assets/voices /usr/share/nginx/html/assets/voices
|
|
COPY assets/credits /usr/share/nginx/html/assets/credits
|
|
COPY assets/effects /usr/share/nginx/html/assets/effects
|
|
COPY assets/closeups /usr/share/nginx/html/assets/closeups
|
|
COPY assets/favicon /usr/share/nginx/html/assets/favicon
|
|
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.
|
|
RUN cd /usr/share/nginx/html \
|
|
&& V=$(sed -n "s/^export const VERSION = '\([0-9.]*\)';$/\1/p" src/version.js) \
|
|
&& test -n "$V" \
|
|
&& 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 \
|
|
&& grep -q "?v=$V" style.css && grep -q "?v=$V" index.html
|
|
|
|
EXPOSE 80
|
|
HEALTHCHECK --interval=30s --timeout=3s CMD wget -qO- http://127.0.0.1/ >/dev/null || exit 1
|