Fix dockerfile and add a quick test

See readme for instructions
This commit is contained in:
Paul Mathieu 2023-07-03 15:12:06 +02:00
parent 09f3765f4f
commit a62ecd15d7
5 changed files with 1007 additions and 9 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
templates/pout.png
templates/*.pdf

View File

@ -1,10 +1,12 @@
FROM alpine FROM alpine
RUN apk --no-cache add python3 inkscape bash imagemagick RUN apk --no-cache add python3 inkscape bash imagemagick ttf-opensans
ADD backend /root/zetikettes ADD backend /root/zetikettes
RUN apk --no-cache add ttf-opensans && cp /root/zetikettes/fonts/*.ttf /usr/share/fonts/TTF/ && fc-cache -fv RUN mkdir -p /usr/share/fonts/TTF \
&& cp /root/zetikettes/fonts/*.ttf /usr/share/fonts/TTF/ \
&& fc-cache -fv
# the script will look for templates in /data # the script will look for templates in /data
WORKDIR /root/zetikettes WORKDIR /root/zetikettes

View File

@ -17,17 +17,27 @@ Nginx is configured to:
Conf is in /etc/nginx/sites-available/default Conf is in /etc/nginx/sites-available/default
Test
----
```
docker run --rm -it -v $PWD/templates:/data zetikettes /bin/bash /root/zetikettes/mkjam.sh
```
This should produce a .pdf in `templates/`. Open it to check that
layout & fonts are correct.
Run Run
--- ---
``` ```
docker run -d --rm -p 8000:8000 -v /var/lib/zetikettes/templates:/data zetikettes docker run -d --rm -p 127.0.0.1:8000:8000 -v /var/lib/zetikettes/templates:/data zetikettes
``` ```
Change available templates Change available templates
-------------------------- --------------------------
1. go to /zetikettes/newtikette.html 1. go to /zetikettes/newtikette.html or konami code from main app
1. add the newtikette 1. add the newtikette
1. still no need to restart the container (magic!) 1. still no need to restart the container (magic!)
2. profit. 2. profit.

View File

@ -7,14 +7,18 @@ SMALL='220' # Small container (220g)
SIZE=$LARGE SIZE=$LARGE
DLUO='décembre 2023' DLUO='décembre 2023'
LOT='0722-2' LOT='0722-2'
TENEUR='50%' TENEUR='50' # %
FRUIT='80g' FRUIT='80' # g
STICKER='Gelée - Cassis.svg' STICKER='Gelée Extra - Cassis.svg'
DATADIR=/data
PDF="`basename \"${STICKER}\" .svg` - ${LOT} (${SIZE}g).pdf" PDF="`basename \"${STICKER}\" .svg` - ${LOT} (${SIZE}g).pdf"
./makesticker.py --landscape --dluo "$DLUO" --lot "$LOT" --teneur "$TENEUR" --fruit "$FRUIT" --size "$SIZE" -o out.svg "$STICKER" && \ here=$(dirname $(readlink -f $0))
./makeplanche.py -o pout.svg -t planche.svg.in out.svg && \ cd $DATADIR
$here/makesticker.py --landscape --dluo "$DLUO" --lot "$LOT" --teneur "$TENEUR" --fruit "$FRUIT" --quantite "$SIZE" -o out.svg "$STICKER" && \
$here/makeplanche.py -o pout.svg -t $here/planche.svg.in out.svg && \
rm out.svg && \ rm out.svg && \
inkscape --export-type="png" --export-dpi=$DEFAULT_DPI pout.svg && \ inkscape --export-type="png" --export-dpi=$DEFAULT_DPI pout.svg && \
rm pout.svg && \ rm pout.svg && \

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.3 MiB