Enhance Dockerfile and documentation for GeoIP directory permissions
Publish telemt-api gateway Docker image / test (push) Successful in 27s
Publish telemt-api gateway Docker image / build-and-push (push) Successful in 1m27s

- Updated Dockerfile to create and set ownership for the /var/lib/telemt-gateway directory, ensuring the gateway user has the necessary permissions.
- Added documentation in GEOIP.md to clarify directory permissions required for GeoIP data downloads, including guidance on volume mounting and user ID consistency.
This commit is contained in:
Denozordec
2026-03-30 01:54:29 +07:00
parent b259d759fd
commit 2a8390e687
3 changed files with 15 additions and 5 deletions
+4 -4
View File
@@ -38,11 +38,11 @@ func downloadRawMMDB(ctx context.Context, client *http.Client, url, destPath str
}
dir := filepath.Dir(destPath)
if err := os.MkdirAll(dir, 0o755); err != nil {
return fmt.Errorf("geoip mkdir: %w", err)
return fmt.Errorf("geoip mkdir %q: %w (directory must exist or be creatable by the process)", dir, err)
}
tmp, err := os.CreateTemp(dir, "geolite-*.mmdb.part")
if err != nil {
return err
return fmt.Errorf("geoip temp file in %q: %w", dir, err)
}
tmpPath := tmp.Name()
_, copyErr := io.Copy(tmp, resp.Body)
@@ -87,11 +87,11 @@ func downloadGzippedMMDB(ctx context.Context, client *http.Client, url, destPath
dir := filepath.Dir(destPath)
if err := os.MkdirAll(dir, 0o755); err != nil {
return fmt.Errorf("geoip mkdir: %w", err)
return fmt.Errorf("geoip mkdir %q: %w (directory must exist or be creatable by the process)", dir, err)
}
tmp, err := os.CreateTemp(dir, "geolite-*.mmdb.part")
if err != nil {
return err
return fmt.Errorf("geoip temp file in %q: %w", dir, err)
}
tmpPath := tmp.Name()
_, copyErr := io.Copy(tmp, gzr)