diff --git a/Dockerfile b/Dockerfile index b4aa4518c844..a72bbb1ad036 100644 --- a/Dockerfile +++ b/Dockerfile @@ -59,7 +59,7 @@ ENV dspace__P__dir=/dspace # because Kubernetes deployment accepts only numeric user IDs when specifying the container user. RUN useradd -u 1100 -m -s /bin/bash dspace # Copy the /dspace directory from 'ant_build' container to /dspace in this container -COPY --chown=dspace:root --from=ant_build /dspace $dspace__P__dir +COPY --from=ant_build /dspace $dspace__P__dir WORKDIR $dspace__P__dir # Need host command for "[dspace]/bin/make-handle-config" RUN apt-get update \ @@ -71,6 +71,17 @@ EXPOSE 8080 8000 # Give java extra memory (2GB) ENV JAVA_OPTS=-Xmx2000m +# App files stay owned by root. dspace writes only to the data folders. /dspace and solr/search/conf are +# sticky, so dspace can add and remove its own entries there (temp, reindex.flag), but not replace the others. +# Missing folders are created so named volumes (not bind mounts) inherit the owner. +RUN for dir in assetstore ctqueues exports handle-server imports log reports sitemaps temp \ + triplestore upload var; do \ + mkdir -p /dspace/$dir && chown -R dspace:dspace /dspace/$dir; \ + done \ + && chown root:dspace /dspace /dspace/solr/search/conf \ + && chmod 1775 /dspace /dspace/solr/search/conf \ + && chmod -R a+rX /dspace/bin + USER dspace # On startup, run DSpace Runnable JAR (uses the "dspace.dir" setting defined in "dspace__P__dir" env variable)