fix: run Docker image as root for data volume compatibility

Revert the non-root container user so existing deployments with
root-owned data volumes keep working without a manual chown step.
This commit is contained in:
vastsa committed 2026-07-23 22:35:00 +08:00
1 parent 24bf6e1a81
commit fc0cbeb4f0
3 files changed
+6 -14

No files matched your search

+5 -5
View File
@@ -90,13 +90,13 @@ class LoginRateLimitTests(SettingsOverrideMixin, unittest.TestCase):
self.assertTrue(ip_limit["login"].check_ip("198.51.100.8"))
class DockerNonRootTests(unittest.TestCase):
def test_dockerfile_runs_as_non_root_user(self):
class DockerRuntimeUserTests(unittest.TestCase):
def test_dockerfile_defaults_to_root_for_volume_compatibility(self):
# 默认 root:兼容已有 data 卷权限;如需非 root 可由编排层自行指定 user
text = Path("Dockerfile").read_text()
self.assertIn("USER appuser", text)
self.assertIn("--uid 1000", text)
self.assertNotIn("USER appuser", text)
compose = Path("docker-compose.yml").read_text()
self.assertIn('user: "1000:1000"', compose)
self.assertNotIn('user: "1000:1000"', compose)
if __name__ == "__main__":