commit | author | age
|
d1e1f5
|
1 |
FROM node |
JK |
2 |
|
|
3 |
ENV CARTO_REPO https://github.com/gravitystorm/openstreetmap-carto |
|
4 |
|
|
5 |
RUN apt-get update \ |
|
6 |
&& apt-get -y dist-upgrade \ |
|
7 |
&& apt-get -y install --no-install-suggests --no-install-recommends git |
|
8 |
|
|
9 |
RUN groupadd -r -g 500 map \ |
|
10 |
&& useradd -r -u 500 -g 500 map \ |
|
11 |
&& mkdir -p /home/map \ |
|
12 |
&& chown map:map /home/map |
|
13 |
|
|
14 |
VOLUME /home/map/carto |
|
15 |
|
|
16 |
USER map |
|
17 |
WORKDIR /home/map |
|
18 |
|
|
19 |
RUN npm install carto polytogeojson |
|
20 |
|
|
21 |
CMD git init carto/repo \ |
|
22 |
&& cd carto/repo \ |
|
23 |
&& git remote add origin "${CARTO_REPO}" || true \ |
|
24 |
&& git fetch origin master \ |
|
25 |
&& git reset --hard origin/master \ |
|
26 |
&& cd - \ |
|
27 |
&& wget -N "${DATA_URL_EXTENT}" \ |
|
28 |
&& node -e 'process.stdout.write(JSON.stringify(require("polytogeojson")(require("fs").readFileSync(0, "utf-8"))));' < `basename "${DATA_URL_EXTENT}"` > carto/extent.geojson \ |
|
29 |
&& cp -Rf carto/repo/symbols carto/ \ |
|
30 |
&& sed -i -e '/^ type: "postgis"$/,/^ key_field: ""$/c\ type: "postgis"\n host: "postgres"\n user: "'$POSTGRES_USER'"\n password: "'$POSTGRES_PASSWORD'"\n dbname: "'$POSTGRES_USER'"\n key_field: ""' carto/repo/project.mml \ |
|
31 |
&& ./node_modules/.bin/carto carto/repo/project.mml > carto/mapnik.xml |