diff --git a/Dockerfile b/Dockerfile
index d764bb126710af61dfe8709bd33fbef3b82fb6f2..eba9f48597109ea746d8f894a52f15d38e5fa7ee 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -40,7 +40,8 @@ COPY lib ./lib
 
 RUN npm run deploy --prefix ./assets && \
     npm run deploy --prefix ./tracker && \
-    mix phx.digest priv/static
+    mix phx.digest priv/static && \
+    mix download_country_database
 
 WORKDIR /app
 COPY rel rel
diff --git a/config/runtime.exs b/config/runtime.exs
index d7a333552aa22eea64042199e54a60e014d862ac..7c9cc1429f62e573ea1283653122f2d355fcbbbc 100644
--- a/config/runtime.exs
+++ b/config/runtime.exs
@@ -66,7 +66,13 @@ cron_enabled = String.to_existing_atom(System.get_env("CRON_ENABLED", "false"))
 custom_domain_server_ip = System.get_env("CUSTOM_DOMAIN_SERVER_IP")
 custom_domain_server_user = System.get_env("CUSTOM_DOMAIN_SERVER_USER")
 custom_domain_server_password = System.get_env("CUSTOM_DOMAIN_SERVER_PASSWORD")
-geolite2_country_db = System.get_env("EOLITE2_COUNTRY_DB", "priv/geodb/dbip-country.mmdb")
+
+geolite2_country_db =
+  System.get_env(
+    "GEOLITE2_COUNTRY_DB",
+    Application.app_dir(:plausible) <> "/priv/geodb/dbip-country.mmdb"
+  )
+
 disable_auth = String.to_existing_atom(System.get_env("DISABLE_AUTH", "false"))
 disable_registration = String.to_existing_atom(System.get_env("DISABLE_REGISTRATION", "false"))
 hcaptcha_sitekey = System.get_env("HCAPTCHA_SITEKEY")