diff --git a/apps/api/Dockerfile b/apps/api/Dockerfile index 8639bfb..f9122ea 100644 --- a/apps/api/Dockerfile +++ b/apps/api/Dockerfile @@ -67,6 +67,21 @@ RUN --mount=type=secret,id=GITHUB_TOKEN,env=GITHUB_TOKEN \ chmod -R 755 /opt/camoufox && \ rm -rf /opt/camoufox/fonts/macos /opt/camoufox/fonts/windows +# Bake the GeoIP database so camoufox-js never downloads it at runtime. +# `geoip: true` (packages/browser/src/pool.ts) otherwise makes camoufox-js fetch +# GeoLite2-City.mmdb from P3TERX/GeoLite.mmdb on first browser launch, into +# $CAMOUFOX_INSTALL_DIR. An interrupted/truncated download leaves a corrupt file that +# camoufox-js reuses forever (getGeolocation only re-downloads when the file is absent), +# crashing every launch with "Invalid Extended Type at offset N val 7" (issue #20). +# Baking a verified copy into the image makes startup deterministic and removes the +# runtime GitHub dependency + first-launch download latency. The size check fails the +# build if the download is truncated, so a corrupt file can never be baked in. +RUN curl -fsSL \ + "https://github.com/P3TERX/GeoLite.mmdb/releases/latest/download/GeoLite2-City.mmdb" \ + -o /opt/camoufox/GeoLite2-City.mmdb && \ + [ "$(stat -c%s /opt/camoufox/GeoLite2-City.mmdb)" -gt 10000000 ] || \ + { echo "GeoLite2-City.mmdb download too small / failed"; exit 1; } + # ── Stage 3: lean runtime (only API-required files) ──────────────────────────── # debian:bookworm-slim replaces ubuntu:22.04 — same glibc family, ~50 MB smaller base. # Camoufox/Firefox require glibc; Alpine's musl is incompatible. @@ -92,6 +107,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ libasound2 \ fonts-liberation \ ca-certificates \ + curl \ && apt-get clean COPY --from=oven/bun:1.3.14 /usr/local/bin/bun /usr/local/bin/bun diff --git a/apps/api/Dockerfile.baseline b/apps/api/Dockerfile.baseline index ba339a8..036c468 100644 --- a/apps/api/Dockerfile.baseline +++ b/apps/api/Dockerfile.baseline @@ -64,6 +64,21 @@ RUN --mount=type=secret,id=GITHUB_TOKEN,env=GITHUB_TOKEN \ chmod -R 755 /opt/camoufox && \ rm -rf /opt/camoufox/fonts/macos /opt/camoufox/fonts/windows +# Bake the GeoIP database so camoufox-js never downloads it at runtime. +# `geoip: true` (packages/browser/src/pool.ts) otherwise makes camoufox-js fetch +# GeoLite2-City.mmdb from P3TERX/GeoLite.mmdb on first browser launch, into +# $CAMOUFOX_INSTALL_DIR. An interrupted/truncated download leaves a corrupt file that +# camoufox-js reuses forever (getGeolocation only re-downloads when the file is absent), +# crashing every launch with "Invalid Extended Type at offset N val 7" (issue #20). +# Baking a verified copy into the image makes startup deterministic and removes the +# runtime GitHub dependency + first-launch download latency. The size check fails the +# build if the download is truncated, so a corrupt file can never be baked in. +RUN curl -fsSL \ + "https://github.com/P3TERX/GeoLite.mmdb/releases/latest/download/GeoLite2-City.mmdb" \ + -o /opt/camoufox/GeoLite2-City.mmdb && \ + [ "$(stat -c%s /opt/camoufox/GeoLite2-City.mmdb)" -gt 10000000 ] || \ + { echo "GeoLite2-City.mmdb download too small / failed"; exit 1; } + # ── Stage 3: lean runtime (only API-required files) ──────────────────────────── # debian:bookworm-slim replaces ubuntu:22.04 — same glibc family, ~50 MB smaller base. # Camoufox/Firefox require glibc; Alpine's musl is incompatible. diff --git a/apps/web/app/components/CompareTable.vue b/apps/web/app/components/CompareTable.vue index 25e1af0..3a47c00 100644 --- a/apps/web/app/components/CompareTable.vue +++ b/apps/web/app/components/CompareTable.vue @@ -59,7 +59,7 @@ const rows = [ }, { feature: "Adaptive tier execution", trawl: "✓ 4 tiers", flaresolver: "✗ always browser", byparr: "~" }, { feature: "Browser engine", trawl: "✓ Camoufox Firefox", flaresolver: "✗ Chrome", byparr: "✓ Camoufox Firefox" }, - { feature: "Docker image size", trawl: "✓ 1.04 GB", flaresolver: "✓ 1.03 GB", byparr: "✗ 4.10 GB" }, + { feature: "Docker image size", trawl: "✓ 1.14 GB", flaresolver: "✓ 1.03 GB", byparr: "✗ 4.10 GB" }, { feature: "Memory footprint (peak)", trawl: "✓ 770 MB", flaresolver: "✗ 500 MB", byparr: "✗ 1.35 GB" }, { feature: "Cloudflare challenge speed", trawl: "✓ 4–15s", flaresolver: "✗ 11–18s", byparr: "✗ 13–18s" }, { feature: "CF Turnstile solving", trawl: "✓ shadow DOM click", flaresolver: "✗", byparr: "✗" },