KSvend Claude Happy commited on
Commit
8126c31
·
1 Parent(s): 71d4554

feat: bundle 50m Natural Earth shapefiles in Docker for offline basemaps

Browse files

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>

Files changed (1) hide show
  1. Dockerfile +7 -0
Dockerfile CHANGED
@@ -16,6 +16,12 @@ RUN pip install --no-cache-dir --only-binary :all: \
16
  numpy scipy matplotlib geopandas shapely pyproj rioxarray xarray \
17
  && pip install --no-cache-dir --prefer-binary cartopy
18
 
 
 
 
 
 
 
19
  # Install remaining deps (lightweight, pure-python or small wheels)
20
  RUN pip install --no-cache-dir --prefer-binary \
21
  "fastapi>=0.110.0" \
@@ -43,6 +49,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
43
  # Copy installed packages from builder
44
  COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
45
  COPY --from=builder /usr/local/bin /usr/local/bin
 
46
 
47
  WORKDIR /app
48
 
 
16
  numpy scipy matplotlib geopandas shapely pyproj rioxarray xarray \
17
  && pip install --no-cache-dir --prefer-binary cartopy
18
 
19
+ # Pre-download 50m Natural Earth data so Cartopy works offline in containers
20
+ RUN python -c "\
21
+ import cartopy.io.shapereader as shpreader; \
22
+ [shpreader.natural_earth(resolution='50m', category=cat, name=name) \
23
+ for cat, name in [('physical','land'),('physical','ocean'),('physical','coastline'),('cultural','admin_0_boundary_lines_lake')]]"
24
+
25
  # Install remaining deps (lightweight, pure-python or small wheels)
26
  RUN pip install --no-cache-dir --prefer-binary \
27
  "fastapi>=0.110.0" \
 
49
  # Copy installed packages from builder
50
  COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
51
  COPY --from=builder /usr/local/bin /usr/local/bin
52
+ COPY --from=builder /root/.local/share/cartopy /root/.local/share/cartopy
53
 
54
  WORKDIR /app
55