-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(backend): TMS issues by using go-tilepacks and go-pmtiles (#2162)
* refactor(backend): remove basemapper.py mbtile/pmtile generator, use go binaries * build: add go-tilepacks & go-pmtiles binaries to backend for basemap gen
- Loading branch information
1 parent
eb2f729
commit 5dbd1cd
Showing
8 changed files
with
176 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
FROM docker.io/alpine/curl:8.11.1 AS base | ||
|
||
|
||
# Download and verify tilepack binary | ||
# FROM base AS tilepack | ||
# ENV GO_TILEPACK_URL=https://github.com/tilezen/go-tilepacks/releases/download/v1.0.0-pre1/tilepack_1.0.0-pre1_linux_amd64.tar.gz \ | ||
# TILEPACK_SHA1SUM=1f235fd3da7f9c8a2710a1a8d44a27c2c98df939 | ||
# RUN curl -fsSLO "$GO_TILEPACK_URL" \ | ||
# && tar -xvzf tilepack_1.0.0-pre1_linux_amd64.tar.gz \ | ||
# && echo "${TILEPACK_SHA1SUM} tilepack" | sha1sum -c - \ | ||
# && chmod +x tilepack \ | ||
# && mv tilepack /tilepack | ||
# FIXME temp workaround using fork until PRs merged | ||
# - https://github.com/tilezen/go-tilepacks/pull/36 | ||
# - https://github.com/tilezen/go-tilepacks/pull/38 | ||
FROM base AS tilepack | ||
ENV GO_TILEPACK_URL=https://github.com/spwoodcock/go-tilepacks/releases/download/0.3.0/tilepack_0.3.0_linux_amd64.tar.gz \ | ||
TILEPACK_SHA1SUM=6b7269735e9fb431de3457c8e2b6aa6d3f3ee49e | ||
RUN curl -fsSLO "$GO_TILEPACK_URL" \ | ||
&& tar -xvzf tilepack_0.3.0_linux_amd64.tar.gz \ | ||
&& echo "${TILEPACK_SHA1SUM} tilepack" | sha1sum -c - \ | ||
&& chmod +x tilepack \ | ||
&& mv tilepack /tilepack | ||
|
||
|
||
|
||
# Download and verify pmtiles binary | ||
FROM base AS pmtiles | ||
ENV GO_PMTILES_URL=https://github.com/protomaps/go-pmtiles/releases/download/v1.25.0/go-pmtiles_1.25.0_Linux_x86_64.tar.gz \ | ||
PMTILES_SHA1SUM=ed4795e24bfcccc4fd07a54dfc7926e15cc835de | ||
RUN curl -fsSLO "$GO_PMTILES_URL" \ | ||
&& tar -xvzf go-pmtiles_1.25.0_Linux_x86_64.tar.gz \ | ||
&& echo "${PMTILES_SHA1SUM} pmtiles" | sha1sum -c - \ | ||
&& chmod +x pmtiles \ | ||
&& mv pmtiles /pmtiles | ||
|
||
|
||
# Add a non-root user to passwd file | ||
FROM base AS useradd | ||
RUN addgroup -g 1000 nonroot | ||
RUN adduser -D -u 1000 -G nonroot nonroot | ||
|
||
|
||
# Deploy the application binary into scratch image | ||
FROM scratch AS release | ||
WORKDIR /app | ||
COPY --from=useradd /etc/group /etc/group | ||
COPY --from=useradd /etc/passwd /etc/passwd | ||
COPY --from=tilepack /tilepack /usr/bin/tilepack | ||
COPY --from=pmtiles /pmtiles /usr/bin/pmtiles | ||
USER nonroot:nonroot | ||
ENTRYPOINT ["tilepack"] |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Basemap Generator Image | ||
|
||
This container image contains binaries for: | ||
|
||
- <https://github.com/tilezen/go-tilepacks> | ||
- <https://github.com/protomaps/go-pmtiles> | ||
|
||
With these, we can generate an mbtiles file from TMS, then also convert to PMTiles. | ||
|
||
## Usage | ||
|
||
```bash | ||
docker run --rm ghcr.io/hotosm/fmtm/basemap-generator:0.3.0 --help | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
IMAGE_NAME=ghcr.io/hotosm/fmtm/basemap-generator:0.3.0 | ||
|
||
echo "Building ${IMAGE_NAME}" | ||
docker build . --tag "${IMAGE_NAME}" | ||
|
||
if [[ -n "$PUSH_IMG" ]]; then | ||
docker push "${IMAGE_NAME}" | ||
fi |
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
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