diff --git a/Dockerfile b/Dockerfile index b751e79..4af8830 100644 --- a/Dockerfile +++ b/Dockerfile @@ -51,12 +51,18 @@ RUN mkdir -p /publish/data /publish/geoip # DBIP_VERSION is pinned, which means the database ages with the image. /healthz # reports the loaded database's build date so a stale one is visible at runtime, # not only at build time; bump this argument in CI on a schedule. -ARG DBIP_VERSION=2026-04 -RUN apt-get update -qq && apt-get install -qq -y curl gzip > /dev/null && \ - mkdir -p /publish/geoip && \ - curl -fsSL "https://download.db-ip.com/free/dbip-city-lite-${DBIP_VERSION}.mmdb.gz" \ - | gunzip > /publish/geoip/GeoLite2-Country.mmdb && \ - ls -la /publish/geoip/GeoLite2-Country.mmdb +ARG DBIP_VERSION=2026-09 +# Downloaded in its own stage with a static curl image: doing it in the SDK +# stage means apt-get update on every cache miss, and that is the slowest and +# least reproducible part of the build (observed: it stalls, the download +# itself takes two seconds). gunzip is part of curlimages/curl's busybox. +FROM curlimages/curl:8.10.1 AS geoip +ARG DBIP_VERSION +RUN mkdir -p /geoip && \ + curl --fail --silent --show-error --location --retry 3 --retry-delay 2 \ + "https://download.db-ip.com/free/dbip-city-lite-${DBIP_VERSION}.mmdb.gz" \ + | gunzip > /geoip/GeoLite2-Country.mmdb && \ + ls -la /geoip/GeoLite2-Country.mmdb FROM mcr.microsoft.com/dotnet/aspnet:${DOTNET_VERSION}-noble-chiseled AS runtime @@ -64,7 +70,7 @@ FROM mcr.microsoft.com/dotnet/aspnet:${DOTNET_VERSION}-noble-chiseled AS runtime WORKDIR /app/api COPY --from=build --chown=app:app /publish/api /app/api COPY --from=build --chown=app:app /publish/data /app/data -COPY --from=build --chown=app:app /publish/geoip /app/geoip +COPY --from=geoip --chown=app:app /geoip /app/geoip USER app:app