Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(refactor): move downloading of geodata into seperate script #79

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,7 @@ RUN ./build-libvips.sh
RUN ./build-perllib-compress-brotli.sh
RUN ./install-ffmpeg.sh

ADD https://download.geonames.org/export/dump/cities500.zip /usr/src/resources/cities500.zip
ADD --chmod=444 https://download.geonames.org/export/dump/admin1CodesASCII.txt /usr/src/resources/admin1CodesASCII.txt
ADD --chmod=444 https://download.geonames.org/export/dump/admin2Codes.txt /usr/src/resources/admin2Codes.txt

RUN umask 0333 && unzip /usr/src/resources/cities500.zip -d /usr/src/resources/ && \
rm /usr/src/resources/cities500.zip && date --iso-8601=seconds | tr -d "\n" > /usr/src/resources/geodata-date.txt
RUN ./download-geodata.sh && mv geodata /usr/src/resources

FROM node:20.15.0-bookworm-slim@sha256:1d05ae8a4d16d201ba911ba7bde30d25d079eb7e27feaf7a99fc383b2ff63fc0 as prod
WORKDIR /usr/src/app
Expand Down
18 changes: 18 additions & 0 deletions server/bin/download-geodata.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

set -e

mkdir geodata
cd geodata

curl -o cities500.zip https://download.geonames.org/export/dump/cities500.zip
curl -o admin1CodesASCII.txt https://download.geonames.org/export/dump/admin1CodesASCII.txt
curl -o admin2Codes.txt https://download.geonames.org/export/dump/admin2Codes.txt
curl -o LICENSE https://creativecommons.org/licenses/by/4.0/legalcode.txt

unzip cities500.zip
rm -f cities500.zip

date --iso-8601=seconds | tr -d "\n" > geodata-date.txt

cd ..