Skip to content
29 changes: 20 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ ENV DSPACE_INSTALL=/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:dspace --from=ant_build /dspace $DSPACE_INSTALL
COPY --from=ant_build /dspace $DSPACE_INSTALL
# Need host command for "[dspace]/bin/make-handle-config"
RUN apt-get update \
&& apt-get install -y --no-install-recommends host \
Expand All @@ -71,7 +71,7 @@ EXPOSE 8080 8009 8000
# Give java extra memory (2GB)
ENV JAVA_OPTS=-Xmx2000m
COPY scripts/restart_debug/* /usr/local/tomcat/bin
COPY --chown=dspace:dspace scripts/index-scripts/* /dspace/bin
COPY scripts/index-scripts/* /dspace/bin
# Link the DSpace 'server' webapp into Tomcat's webapps directory.
# This ensures that when we start Tomcat, it runs from /server path (e.g. http://localhost:8080/server/)
RUN ln -s $DSPACE_INSTALL/webapps/server /usr/local/tomcat/webapps/server
Expand All @@ -82,13 +82,24 @@ RUN ln -s $DSPACE_INSTALL/webapps/server /usr/local/tomcat/webapps/server
# ln -s $DSPACE_INSTALL/webapps/server /usr/local/tomcat/webapps/ROOT

WORKDIR /usr/local/tomcat/bin
RUN chmod u+x redebug.sh undebug.sh custom_run.sh
RUN chmod a+rx redebug.sh undebug.sh custom_run.sh

RUN mkdir -p /dspace/assetstore \
&& chown dspace:dspace /dspace/assetstore \
&& chown -Rv dspace:dspace /usr/local/tomcat
# NOTE: /dspace/assetstore does not exist in the base image.
# We create it so Docker named volumes inherit the correct ownership.
# This only works for *named volumes* — bind mounts use host permissions.
# App files stay owned by root. dspace writes only to the data folders, Tomcat's webapps (namespace link)
# and item-submission.xml. /dspace, config and solr/search/conf are sticky, so dspace can add and remove
# its own entries there (temp folders, config backups, 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 matomo_reports reports sitemaps \
temp triplestore upload var; do \
mkdir -p /dspace/$dir && chown -R dspace:dspace /dspace/$dir; \
Comment on lines +92 to +93
done \
&& chown root:dspace /dspace /dspace/solr/search/conf \
&& chmod 1775 /dspace /dspace/solr/search/conf \
&& chmod -R a+rX /dspace/bin \
&& mkdir -p /usr/local/tomcat/conf/Catalina/localhost \
&& chown dspace:dspace /usr/local/tomcat/webapps \
&& touch /dspace/config/local.cfg \
&& chown root:dspace /dspace/config \
&& chmod 1775 /dspace/config \
&& chown dspace:dspace /dspace/config/item-submission.xml

USER dspace
2 changes: 1 addition & 1 deletion scripts/restart_debug/custom_run.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
FILE=do_debug.txt
FILE=/home/dspace/do_debug.txt
if [ -f "$FILE" ]; then
export JPDA_ADDRESS="*:8000"
./catalina.sh jpda run
Expand Down
2 changes: 1 addition & 1 deletion scripts/restart_debug/redebug.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash
touch do_debug.txt
touch /home/dspace/do_debug.txt
./shutdown.sh
2 changes: 1 addition & 1 deletion scripts/restart_debug/undebug.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash
rm do_debug.txt
rm /home/dspace/do_debug.txt
./shutdown.sh
Loading