@@ -153,11 +153,11 @@ func (h *Headway) Build(ctx context.Context) (*dagger.Directory, error) {
153153
154154 output = output .WithFile (h .Area + ".osm.pbf" , h .OSMExport .File )
155155
156- mbtiles , err := h .Mbtiles (ctx )
156+ pmtiles , err := h .Pmtiles (ctx )
157157 if err != nil {
158- return nil , fmt .Errorf ("failed to build mbtiles : %w" , err )
158+ return nil , fmt .Errorf ("failed to build pmtiles : %w" , err )
159159 }
160- output = output .WithFile (h .Area + ".mbtiles " , mbtiles )
160+ output = output .WithFile (h .Area + ".pmtiles " , pmtiles )
161161
162162 valhalla := h .ValhallaTiles (ctx )
163163 output = output .WithFile (h .Area + ".valhalla.tar.zst" , valhalla .Compress ())
@@ -217,11 +217,11 @@ func martinBinary() *dagger.File {
217217 const martinFeatures = "fonts,mbtiles,pmtiles,styles,sprites"
218218
219219 // To build from source (e.g. for debugging a fork), set this to true
220- const buildFromSource = false
220+ const buildFromSource = true
221221 if buildFromSource {
222222 return rustContainer ("git" ).
223223 WithEnvVariable ("CACHE_BUSTER" , time .Now ().String ()).
224- WithExec ([]string {"git" , "clone" , "--branch" , "mkirk/fix-forwarding-header " , "--depth=1" , "https://github.com/michaelkirk/martin.git" , "/martin" }).
224+ WithExec ([]string {"git" , "clone" , "--branch" , "mkirk/relative-source-urls " , "--depth=1" , "https://github.com/michaelkirk/martin.git" , "/martin" }).
225225 WithWorkdir ("/martin" ).
226226 WithExec ([]string {"cargo" , "build" , "--release" , "--locked" , "--no-default-features" , "--features" , martinFeatures }).
227227 File ("target/release/martin" )
@@ -244,15 +244,15 @@ func (h *Headway) TileserverServeContainer(ctx context.Context) *dagger.Containe
244244 WithDefaultArgs ([]string {"/app/configure-and-run.sh" })
245245}
246246
247- // Builds mbtiles using Planetiler
248- func (h * Headway ) Mbtiles (ctx context.Context ) (* dagger.File , error ) {
247+ // Builds maptiles using Planetiler
248+ func (h * Headway ) Pmtiles (ctx context.Context ) (* dagger.File , error ) {
249249
250250 if h .OSMExport == nil || h .OSMExport .File == nil {
251- panic ("Headway.OSMExport.File must be set to build mbtiles " )
251+ panic ("Headway.OSMExport.File must be set to build pmtiles " )
252252 }
253253
254254 container := dag .Container ().
255- From ("ghcr.io/onthegomap/planetiler:0.7.0 " )
255+ From ("ghcr.io/onthegomap/planetiler:0.10.2 " )
256256
257257 memoryScript := h .ServiceDir ("tilebuilder" ).File ("percent-of-available-memory" )
258258 memoryBudget , err := container .
@@ -266,30 +266,34 @@ func (h *Headway) Mbtiles(ctx context.Context) (*dagger.File, error) {
266266 fixturesUrl := getEnvWithDefault ("HEADWAY_PLANETILER_FIXTURES_URL" , "https://data.maps.earth/planetiler_fixtures/sources.tar" )
267267
268268 container = container .
269+ WithMountedFile ("/tmp/planetile-fixture-sources.tar" , downloadFile (fixturesUrl )).
269270 WithExec ([]string {"mkdir" , "-p" , "/data/sources" }).
270- WithExec ([]string {"sh" , "-c" , "curl --no-progress-meter " + fixturesUrl + " | tar -x --directory /data/sources" }).
271+ WithExec ([]string {"sh" , "-c" , "tar -x --directory /data/sources -f /tmp/planetile-fixture-sources.tar " }).
271272 WithMountedFile ("/data/data.osm.pbf" , h .OSMExport .File )
272273
273274 entrypoint , err := container .Entrypoint (ctx )
274275 if err != nil {
275276 return nil , fmt .Errorf ("failed to get entrypoint: %w" , err )
276277 }
277-
278+ output := "/data/output.pmtiles"
279+ entrypoint = append (entrypoint ,
280+ "--osm_path=/data/data.osm.pbf" ,
281+ "--force" ,
282+ fmt .Sprintf ("--output=%s" , output ),
283+ )
278284 if h .IsPlanetBuild {
279285 container = container .WithExec (append (entrypoint ,
280- "--osm_path=/data/data.osm.pbf" ,
281- "--force" ,
282286 "--bounds=planet" ,
283287 "--nodemap-type=array" ,
284288 "--storage=mmap" ,
285289 fmt .Sprintf ("-Xmx%d" , memoryBudget ),
286290 "-XX:MaxHeapFreeRatio=40" ,
287291 ))
288292 } else {
289- container = container .WithExec (append ( entrypoint , "--osm_path=/data/data.osm.pbf" , "--force" ) )
293+ container = container .WithExec (entrypoint )
290294 }
291295
292- return container .File ("/data/ output.mbtiles" ), nil
296+ return container .File (output ), nil
293297}
294298
295299/**
@@ -564,6 +568,24 @@ func WithAptPackages(container *dagger.Container, packages ...string) *dagger.Co
564568 return container .WithExec ([]string {"sh" , "-c" , cmd })
565569}
566570
571+ // Publish a container to multiple registry addresses in a single Dagger
572+ // session, so every tag points at the same image digest.
573+ func (h * Headway ) PublishMulti (
574+ ctx context.Context ,
575+ container * dagger.Container ,
576+ addresses []string ,
577+ ) ([]string , error ) {
578+ out := make ([]string , 0 , len (addresses ))
579+ for _ , addr := range addresses {
580+ ref , err := container .Publish (ctx , addr )
581+ if err != nil {
582+ return nil , fmt .Errorf ("publishing %q: %w" , addr , err )
583+ }
584+ out = append (out , ref )
585+ }
586+ return out , nil
587+ }
588+
567589func compressDir (dir * dagger.Directory ) * dagger.File {
568590 container := slimContainer ("zstd" ).
569591 WithExec ([]string {"mkdir" , "/app" }).
0 commit comments