Docker: let the image run as any user
The image only started as root: Inline aborts with "Couldn't find an
appropriate DIRECTORY for Inline to use" when /derekovecs/_Inline is not
writable, and there is no compiler left in the image to build the XS part
somewhere else.
That rules out deployments whose models come from an NFS export with
root_squash, where the container has to run as the owning user. Making the
Inline cache writable for everybody is enough, the code directory stays
untouched. Verified with --user: the image serves neighbours and count based
collocators with the models mounted read only.
The hypnotoad pid file is written relative to the working directory, so such a
deployment should set pid_file to an absolute path outside of it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Change-Id: I28a91d65f208250d3adb4b4a923198c37211f81b
diff --git a/Dockerfile.remove-example-data b/Dockerfile.remove-example-data
index d3f0e61..f09f9a7 100644
--- a/Dockerfile.remove-example-data
+++ b/Dockerfile.remove-example-data
@@ -2,6 +2,11 @@
RUN rm -rf /derekovecs/example-models
RUN hypnotoad -t script/derekovecs-server || true
+# Inline insists on a writable directory even when its cache is up to date, and
+# there is no compiler left in the image to rebuild elsewhere. Without this the
+# image only runs as root, which is no option when the models come from an NFS
+# export with root_squash.
+RUN chmod -R a+rwX /derekovecs/_Inline
RUN rm -rf /usr/bin/g++* /usr/include/linux /usr/bin/gcc* /usr/bin/make /usr/lib/gcc /usr/bin/x86_64-alpine-linux*
RUN rm -rf /derekovecs/example-models