Files
maptool/Dockerfile
T
randy e63f6f7ce7
CI / check (push) Successful in 19s
CI / deploy (push) Successful in 1m2s
Enable YJIT in the container
The official Ruby image ships YJIT but leaves it off. Set via ENV so the
puma server and rake jobs run through podman compose exec both get it.
2026-11-12 12:27:42 +01:00

63 lines
3.1 KiB
Docker

# trixie, not bookworm: Planetiler needs Java 21+ (UnsupportedClassVersionError
# otherwise) and bookworm's own default-jre-headless is only Java 17 —
# bookworm-backports doesn't carry a newer one either, only trixie's does.
FROM ruby:4.0.9-slim-trixie
# YJIT is compiled into the official image but off unless asked for. Set
# here rather than as a puma flag so `podman compose exec ... rake` jobs
# (places:index, gpx backfills) get it too.
ENV RUBY_YJIT_ENABLE=1
# build-essential: puma has a native (C) extension; harmless if the
# platform-specific gem in Gemfile.lock already has a precompiled binary
# matching this base image, but keeps the build working if it doesn't.
# ca-certificates/curl: needed for the go-pmtiles/planetiler.jar downloads
# below (also handy for anyone debugging inside a running container).
# default-jre-headless: Planetiler is a JVM tool (see PLANETILER_VERSION
# below) — headless since this never touches a display; trixie's version
# of this package is Java 21, see above.
# osmium-tool: merges multiple countries' OSM extracts into one file before
# handing them to Planetiler (lib/maptool/pmtiles_builder.rb) — a normal
# Debian package, no separate download/pinning needed like the other two.
RUN apt-get update && apt-get install --no-install-recommends -y build-essential ca-certificates curl default-jre-headless osmium-tool \
&& rm -rf /var/lib/apt/lists/*
# The `pmtiles` CLI (lib/maptool/pmtiles_builder.rb's "Regenerate for
# current view" — see docs/development.adoc) — no Debian package exists,
# so this pulls the static binary straight from its own GitHub releases.
# Architecture-matched (Debian's dpkg arch name translated to the release
# asset's own naming) rather than hardcoded amd64, so this still works
# building on an arm64 host. Pinned, like every other dependency in this
# repo (Gemfile, docs/third-party-notices.adoc) — bump PMTILES_VERSION
# deliberately, not via `latest`.
# renovate: datasource=github-releases depName=protomaps/go-pmtiles
ARG PMTILES_VERSION=1.31.2
RUN set -eux; \
case "$(dpkg --print-architecture)" in \
amd64) pmtiles_arch=x86_64 ;; \
arm64) pmtiles_arch=arm64 ;; \
*) echo "unsupported architecture for go-pmtiles: $(dpkg --print-architecture)" >&2; exit 1 ;; \
esac; \
curl -fsSL "https://github.com/protomaps/go-pmtiles/releases/download/v${PMTILES_VERSION}/go-pmtiles_${PMTILES_VERSION}_Linux_${pmtiles_arch}.tar.gz" \
| tar xz -C /usr/local/bin pmtiles
# Planetiler (lib/maptool/pmtiles_builder.rb's offline.pmtiles build,
# replacing an earlier Protomaps-CDN-based pipeline — see
# docs/development.adoc) — a single JVM fat jar, no per-arch variant needed
# unlike go-pmtiles above. Default PLANETILER_JAR path (pmtiles_builder.rb)
# expects it here.
# renovate: datasource=github-releases depName=onthegomap/planetiler
ARG PLANETILER_VERSION=0.10.2
RUN curl -fsSL "https://github.com/onthegomap/planetiler/releases/download/v${PLANETILER_VERSION}/planetiler.jar" \
-o /usr/local/lib/planetiler.jar
WORKDIR /app
COPY Gemfile Gemfile.lock ./
RUN bundle install
COPY . .
EXPOSE 4567
CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]