Initial port of phantom-firemap

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2017-06-11 22:28:15 +02:00
commit 602b5c2dbb
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
3 changed files with 42 additions and 0 deletions

16
Dockerfile Normal file
View file

@ -0,0 +1,16 @@
FROM debian
ADD https://dl-ssl.google.com/linux/linux_signing_key.pub /tmp/linux_signing_key.pub
ADD google.list /etc/apt/sources.list.d/google.list'
RUN set -ex \
&& apt-key add /tmp/linux_signing_key.pub \
&& apt-get update \
&& apt-get install -y imagemagick google-chrome-stable
VOLUME ["/data"]
ENTRYPOINT ["/usr/local/bin/run.sh"]
ADD run.sh /usr/local/bin/run.sh
WORKDIR /data

1
google.list Normal file
View file

@ -0,0 +1 @@
deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main

25
run.sh Executable file
View file

@ -0,0 +1,25 @@
#!/bin/bash -ex
DPI=150
W=1754 # 150 x 11.69
H=1241 # 150 x 8.27
ZOOM=$1
LAT=$2
LON=$3
TARGET="$4"
google-chrome-stable --version
google-chrome-stable --headless --no-sandbox \
--hide-scrollbars --disable-gpu --screenshot \
--window-size=$W,$H --virtual-time-budget=5000 \
"http://openfiremap.org/?zoom=${ZOOM}&lat=${LAT}&lon=${LON}&layers=B0000TF"
ls -lh
mv screenshot.png /data/${TARGET}.png
chmod 0644 /data/${TARGET}.png
exec convert /data/${TARGET}.png -compress jpeg -quality 90 \
-resize ${W}x${H} -gravity center -extent ${W}x${H} \
-units PixelsPerInch -density ${DPI} \
-repage ${W}x${H} /data/${TARGET}.pdf