-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #171 from hotosm/feature/tippecanoe_docker
Feature : Tippecanoe Docker Support
- Loading branch information
Showing
5 changed files
with
52 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ FROM docker.io/python:${PYTHON_VERSION}-slim-bookworm as base | |
ARG [email protected] | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
|
||
FROM base as builder | ||
|
||
ENV PIP_NO_CACHE_DIR=1 | ||
|
@@ -26,7 +25,6 @@ RUN pip install --user --no-cache-dir --upgrade pip \ | |
&& pip install --user --no-cache-dir -r requirements.txt \ | ||
&& pip install --user --no-cache-dir -e . | ||
|
||
|
||
FROM base as runner | ||
WORKDIR /home/appuser | ||
ENV PIP_NO_CACHE_DIR=1 | ||
|
@@ -48,13 +46,19 @@ COPY setup.py . | |
COPY API/ ./API/ | ||
COPY src/ ./src/ | ||
|
||
# Use a separate stage to pull the tippecanoe image | ||
FROM docker.io/itskshitiz321/tippecanoe as tippecanoe-builder | ||
|
||
FROM runner as prod | ||
USER root | ||
|
||
# Copy tippecanoe binaries from the tippecanoe stage | ||
COPY --from=tippecanoe-builder /usr/local/bin/tippecanoe* /usr/local/bin/ | ||
COPY --from=tippecanoe-builder /usr/local/bin/tile-join /usr/local/bin/ | ||
|
||
RUN useradd --system --uid 900 --home-dir /home/appuser --shell /bin/false appuser \ | ||
&& chown -R appuser:appuser /home/appuser | ||
|
||
|
||
FROM runner as prod | ||
USER appuser | ||
|
||
CMD ["uvicorn", "API.main:app", "--reload", "--host", "0.0.0.0", "--port", "8000", "--no-use-colors", "--proxy-headers"] | ||
|
||
# HEALTHCHECK --interval=1m --timeout=3s CMD curl -f http://localhost:8000 || exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
WITH t1 AS (SELECT osm_id, ST_Centroid(geom) AS geom FROM nodes wl WHERE country <@ Array[0]), | ||
t2 AS (SELECT t1.osm_id, CASE WHEN COUNT(cg.cid) = 0 THEN ARRAY[1000]::INTEGER[] ELSE ARRAY_AGG(COALESCE(cg.cid, 1000)) END AS aa_fids FROM t1 LEFT JOIN countries cg ON ST_Intersects(t1.geom, cg.geometry) GROUP BY t1.osm_id) | ||
UPDATE nodes uw SET country = t2.aa_fids FROM t2 WHERE t2.osm_id = uw.osm_id; | ||
WITH t1 AS (SELECT osm_id, ST_Centroid(geom) AS geom FROM relations wl WHERE country <@ Array[0]), t2 AS (SELECT t1.osm_id, CASE WHEN COUNT(cg.cid) = 0 THEN ARRAY[1000]::INTEGER[] ELSE ARRAY_AGG(COALESCE(cg.cid, 1000)) END AS aa_fids FROM t1 LEFT JOIN countries cg ON ST_Intersects(t1.geom, cg.geometry) GROUP BY t1.osm_id) UPDATE relations uw SET country = t2.aa_fids FROM t2 WHERE t2.osm_id = uw.osm_id; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters